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(tests): [Bigtable] add conformance tests and proxy #7959

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c0a02e0
feat(tests): [Bigtable] add conformance tests and proxy
bshaffer Dec 18, 2024
57b960a
exclude gencode in cs
bshaffer Dec 23, 2024
9d7998f
add proxy github action for testing
bshaffer Jan 10, 2025
c23ff7c
add workflow dispatch
bshaffer Jan 10, 2025
5c1ecd8
install roadrunner in conformance actions
bshaffer Jan 10, 2025
201aee7
fix rr version
bshaffer Jan 10, 2025
cf39afe
fix rr version (again)
bshaffer Jan 10, 2025
3f30159
add sudo
bshaffer Jan 10, 2025
9d41929
cleanup imports, use InseureCredentials
bshaffer Jan 10, 2025
af657c9
add logic for CheckAndMutateRows
bshaffer Jan 10, 2025
80deb87
fix timeout, fix numworkers
bshaffer Jan 10, 2025
afdd928
fix timeout error
bshaffer Jan 10, 2025
1ec7bce
fix call to checkAndMutateRow
bshaffer Jan 10, 2025
03e201b
use InsecureCredentialsWrapper
bshaffer Jan 11, 2025
6bda3c6
set hasEmulator to true to use http instead of https
bshaffer Jan 13, 2025
9680d64
add back insecure credentials wrapper
bshaffer Jan 13, 2025
970aca9
enable grpc in github actions
bshaffer Jan 13, 2025
c704936
more work on the proxy
bshaffer Jan 14, 2025
f5d63f5
add support for ReadModifyWriteRow
bshaffer Jan 15, 2025
8b09085
add skip_tests
bshaffer Jan 16, 2025
8dcb87c
remove index
bshaffer Jan 16, 2025
0fbcd8d
WIP
bshaffer Jan 16, 2025
8ddd126
fixes NonTransientErrors test, moves conformance.sh
bshaffer Jan 16, 2025
5a63eae
Merge branch 'main' into bigtable-conformance-tests
bshaffer Jan 21, 2025
6a111cd
checkout to proxy v0.0.3, remove ping.php
bshaffer Jan 21, 2025
3f8596c
Merge branch 'main' into bigtable-conformance-tests
bshaffer Jan 27, 2025
2a8b523
Merge branch 'bigtable-conformance-tests' of github.com:googleapis/go…
bshaffer Jan 27, 2025
6cc26cb
update protos, add ExecuteQuery rpc
bshaffer Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/conformance-tests-bigtable-emulator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Github action job to test core java library features on
# downstream client libraries before they are released.
on:
push:
branches:
- main
paths:
- 'Bigtable/**'
- '.github/workflows/conformance-tests-bigtable-emulator.yaml'
pull_request:
paths:
- 'Bigtable/**'
- '.github/workflows/conformance-tests-bigtable-emulator.yaml'
workflow_dispatch:
name: Run Bigtable Conformance Tests With Emulator
jobs:
conformance:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: grpc

- name: Checkout Bigtable conformance tests
uses: actions/checkout@v4
with:
repository: googleapis/cloud-bigtable-clients-test
ref: main
path: cloud-bigtable-clients-test

- uses: actions/setup-go@v5
with:
go-version: '>=1.20.2'

- name: Install Road Runner PHP
run: |
wget https://github.com/roadrunner-server/roadrunner/releases/download/v2024.3.1/roadrunner-2024.3.1-linux-amd64.deb
sudo dpkg -i roadrunner-2024.3.1-linux-amd64.deb

- run: bash Bigtable/tests/Conformance/proxy/conformance.sh
4 changes: 2 additions & 2 deletions .github/workflows/conformance-tests-storage-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
- main
paths:
- 'Storage/**'
- '.github/workflows/emulator-conformance-tests-storage.yaml'
- '.github/workflows/conformance-tests-storage-emulator.yaml'
pull_request:
paths:
- 'Storage/**'
- '.github/workflows/emulator-conformance-tests-storage.yaml'
- '.github/workflows/conformance-tests-storage-emulator.yaml'
name: Run Storage Retry Conformance Tests With Emulator
jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions Bigtable/src/ResumableStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public function readAll()
$headers['bigtable-attempt'] = [(string) $totalAttempt];
($this->delayFunction)($currentAttempt);
}

$stream = call_user_func_array(
[$this->gapicClient, $this->method],
[$this->request, ['headers' => $headers] + $this->callOptions]
Expand Down
3 changes: 2 additions & 1 deletion Bigtable/src/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ private function mutateRowsWithEntries(array $entries, array $options = [])
$rowMutationsFailedResponse[] = [
'rowKey' => $entries[$mutateRowsResponseEntry->getIndex()]->getRowKey(),
'statusCode' => $mutateRowsResponseEntry->getStatus()->getCode(),
'message' => $mutateRowsResponseEntry->getStatus()->getMessage()
'message' => $mutateRowsResponseEntry->getStatus()->getMessage(),
'index' => $mutateRowsResponseEntry->getIndex(),
];
} else {
unset($entries[$mutateRowsResponseEntry->getIndex()]);
Expand Down
30 changes: 30 additions & 0 deletions Bigtable/tests/Conformance/proxy/.rr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3"
rpc:
listen: "tcp://127.0.0.1:6001"

server:
command: "php worker.php"
relay: "pipes"
relay_timeout: "20s"

kv:
memory-cache:
driver: memory
config: { }

grpc:
listen: "tcp://127.0.0.1:9999"
proto: ["test_proxy.proto"]
max_send_msg_size: 50
max_recv_msg_size: 50
max_connection_idle: 0s
max_connection_age: 0s
max_connection_age_grace: 0s
max_concurrent_streams: 10
ping_time: 1s
timeout: 200s
pool:
num_workers: 5
max_jobs: 0
allocate_timeout: 60s
destroy_timeout: 60s
24 changes: 24 additions & 0 deletions Bigtable/tests/Conformance/proxy/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "google-testing/proxy-bigtable-server",
"description": "Proxy Bigtable Server",
"repositories": [
{
"type": "path",
"url": "../../.."
}
],
"require": {
"google/cloud-bigtable": "*",
"grpc/grpc": "^1.36",
"spiral/roadrunner-cli": "^2.6",
"spiral/roadrunner-grpc": "^3.4",
"spiral/roadrunner-kv": "^4.3"
},
"autoload": {
"psr-4": {
"": "src"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
55 changes: 55 additions & 0 deletions Bigtable/tests/Conformance/proxy/conformance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

## Get the directory of the build script
proxyDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
projectDir=$(realpath $proxyDir/../../../..)

# Install composer dependencies in the "proxy" directory
composer update -d $proxyDir

set +e

# declare -a configs=("default" "enable_all")
declare -a configs=("default") # PHP only supports "default" feature flags for now
for config in "${configs[@]}"
do
# Start the proxy in a separate process
rr serve -w $proxyDir &
proxyPID=$!

pushd .
cd $projectDir/cloud-bigtable-clients-test/tests

skipTests=$(sed -n 'H;${x;s/\n/\\|/g;s/^\\|//;p;};d' < $proxyDir/known_failures.txt)
eval "go test -v -proxy_addr=:9999 -skip ${skipTests}"
returnCode=$?
popd

# Stop the proxy
kill ${proxyPID}

if [[ ${returnCode} -gt 0 ]]
then
echo "Conformance test failed for config: ${config}"
RETURN_CODE=${returnCode}
else
echo "Conformance test passed for config: ${config}"
fi
done

exit ${RETURN_CODE}
10 changes: 10 additions & 0 deletions Bigtable/tests/Conformance/proxy/known_failures.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
_Retry_WithRoutingCookie
_Retry_WithRetryInfo
TestMutateRows_Generic_DeadlineExceeded
TestReadRow_Generic_DeadlineExceeded
TestReadRows_NoRetry_OutOfOrderError
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove TestReadRows_NoRetry_OutOfOrderError, TestReadRows_Retry_StreamReset, TestReadRows_Retry_PausedScan and TestReadRows_Retry_LastScannedRow from this list? So we don't forget about them :) We don't have to mark conformance test passing as a required step for presubmit for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally rather skip these and have them passing (in order to ensure no regression) than to have them fail and ignore the failing tests going forward.

I've entered bugs to fix these failing tests, which is a better place to keep track of these issues, so I don't think we'll forget them.

TestReadRows_Retry_StreamReset
TestReadRows_Retry_PausedScan
TestReadRows_Retry_LastScannedRow
TestReadRows_ReverseScans_FeatureFlag_Enabled
TestReadRows_Generic_DeadlineExceeded
17 changes: 17 additions & 0 deletions Bigtable/tests/Conformance/proxy/ping.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use Google\Bigtable\Testproxy\CreateClientRequest;

$client = new \ProxyClient('127.0.0.1:9999', [
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
]);

$message = new CreateClientRequest();

[$response, $status] = $client->CreateClient($message)->wait();

echo $response->serializeToJsonString() . PHP_EOL;

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
Loading