Skip to content

Commit

Permalink
Add a test proxy to support client conformance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Eagar committed Apr 15, 2024
1 parent 77be955 commit 351fb41
Show file tree
Hide file tree
Showing 9 changed files with 928 additions and 1 deletion.
1 change: 1 addition & 0 deletions google-cloud-bigtable/lib/google/cloud/bigtable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def self.new_with_emulator project_id, emulator_host, timeout
def self.resolve_credentials given_credentials, scope
credentials = given_credentials || default_credentials(scope: scope)
return credentials if credentials.is_a? Google::Auth::Credentials
return credentials if credentials.is_a? GRPC::Core::Channel
Bigtable::Credentials.new credentials, scope: scope
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def check_and_mutate_row key, predicate, on_match: nil, otherwise: nil
response = service.check_and_mutate_row(
path,
key,
predicate_filter: predicate.to_grpc,
predicate_filter: predicate&.to_grpc,
true_mutations: true_mutations,
false_mutations: false_mutations,
app_profile_id: @app_profile_id
Expand Down
1 change: 1 addition & 0 deletions google-cloud-bigtable/test/test_proxy/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.2
9 changes: 9 additions & 0 deletions google-cloud-bigtable/test/test_proxy/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

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"
28 changes: 28 additions & 0 deletions google-cloud-bigtable/test/test_proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

This is a test proxy for Bigtable client conformance tests, created following these guides: https://github.com/googleapis/cloud-bigtable-clients-test/blob/main/docs/test_proxy.md#additional-notes

## Run the Proxy

Run `bundle install` and then:

```bash
$ export PORT=1234 # default 9999 if not set
$ bundle exec ruby test_proxy.rb
```

## Protos

The file `proto/test_proxy.proto` was copied from https://github.com/googleapis/cndb-client-testing-protos/blob/main/google/bigtable/testproxy/test_proxy.proto, and compiled to `lib` via:

```bash
$ git clone git@github.com:googleapis/googleapis
$ git clone git@github.com/googleapis/cndb-client-testing-protos

$ bundle exec grpc_tools_ruby_protoc \
-I googleapis \
-I cndb-client-testing-protos \
--ruby_out=lib \
--grpc_out=lib \
--proto_path=proto \
proto/test_proxy.proto
```

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

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

Loading

0 comments on commit 351fb41

Please sign in to comment.