Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a test proxy for Bigtable client conformance tests #25680

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
meagar marked this conversation as resolved.
Show resolved Hide resolved
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,
meagar marked this conversation as resolved.
Show resolved Hide resolved
true_mutations: true_mutations,
false_mutations: false_mutations,
app_profile_id: @app_profile_id
Expand Down
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.