Skip to content

Commit

Permalink
chore(bigtable): fix conformance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma committed Jul 22, 2024
1 parent 12ef2ad commit 6bffe0b
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 56 deletions.
1 change: 1 addition & 0 deletions google-cloud-bigtable/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Metrics/BlockLength:
- "google-cloud-bigtable.gemspec"
- "Rakefile"
- "lib/google-cloud-bigtable.rb"
- ".toys.rb"
Metrics/ClassLength:
Max: 400
Metrics/PerceivedComplexity:
Expand Down
49 changes: 48 additions & 1 deletion google-cloud-bigtable/.toys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

toys_version! ">= 0.15.3"
toys_version! ">= 0.15.6"

if ENV["RUBY_COMMON_TOOLS"]
common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"]
Expand All @@ -24,3 +24,50 @@
path: "toys/gapic",
update: true
end

tool "conformance" do
tool "gen-protos" do
include :exec, e: true
include :gems
include :git_cache

def run
setup
generate_conformance
generate_test_proxy
end

def setup
gem "grpc-tools", "~> 1.65"
@googleapis_dir = git_cache.get "https://github.com/googleapis/googleapis.git", update: true
Dir.chdir context_directory
end

def generate_conformance
Dir.chdir "conformance/v2/proto" do
cmd = [
"grpc_tools_ruby_protoc",
"--ruby_out", ".",
"-I", ".",
"-I", @googleapis_dir,
"google/cloud/conformance/bigtable/v2/tests.proto"
]
exec cmd
end
end

def generate_test_proxy
Dir.chdir "test/test_proxy/proto" do
cmd = [
"grpc_tools_ruby_protoc",
"--ruby_out", ".",
"--grpc_out", ".",
"-I", ".",
"-I", @googleapis_dir,
"google/bigtable/testproxy/test_proxy.proto"
]
exec cmd
end
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions google-cloud-bigtable/test/test_proxy/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "https://rubygems.org"

gem "google-cloud-bigtable", path: "../../"
gem "grpc", "~> 1.62"
gem "grpc-tools", "~> 1.62"
gem "googleapis-common-protos", "~> 1.5"
gem "googleapis-common-protos-types", "~> 1.14"
gem "grpc", "~> 1.65"
gem "grpc-tools", "~> 1.65"
gem "googleapis-common-protos", "~> 1.6"
gem "googleapis-common-protos-types", "~> 1.15"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions google-cloud-bigtable/test/test_proxy/test_proxy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated protos live here
$LOAD_PATH << File.join(__dir__, "lib")
$LOAD_PATH << File.join(__dir__, "proto")

require "grpc"
require "google/cloud/bigtable"
Expand Down Expand Up @@ -88,8 +88,10 @@ def table name
attr_accessor :instance_id
attr_accessor :app_profile_id

def initialize client_id:, data_target:, project_id:, instance_id:, app_profile_id:, per_operation_timeout:,
optional_feature_config:
def initialize client_id:, data_target:, project_id:, instance_id:,
app_profile_id: nil,
per_operation_timeout: nil,
optional_feature_config: :OPTIONAL_FEATURE_CONFIG_DEFAULT

LOGGER.debug "Building client #{client_id}"

Expand Down

0 comments on commit 6bffe0b

Please sign in to comment.