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

test: Add conformance tests #1349

Merged
merged 42 commits into from
Oct 12, 2023

Conversation

danieljbruce
Copy link
Contributor

@danieljbruce danieljbruce commented Oct 3, 2023

Add conformance tests that use the test proxy to ensure the client is running correctly. This PR should be very similar to https://github.com/googleapis/java-bigtable/pull/1699 which adds conformance tests to java-bigtable. A list of known test failures is also provided so that we only test against the test proxy tests that pass and our continuous integration pipeline passes. The idea is that we want to reduce this list over time as the test proxy improves.

Add conformance tests that use the test proxy to ensure the client is running correctly.
@danieljbruce danieljbruce requested review from a team as code owners October 3, 2023 20:52
@conventional-commit-lint-gcf
Copy link

conventional-commit-lint-gcf bot commented Oct 3, 2023

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Oct 3, 2023
@generated-files-bot
Copy link

generated-files-bot bot commented Oct 3, 2023

Warning: This pull request is touching the following templated files:

  • .kokoro/conformance.sh - .kokoro files are templated and should be updated in synthtool

@product-auto-label product-auto-label bot added the api: bigtable Issues related to the googleapis/nodejs-bigtable API. label Oct 3, 2023
@danieljbruce danieljbruce marked this pull request as draft October 3, 2023 21:04
If the yaml config sets up node then the node test proxy can be tested.
This reverts commit 2bb0eed.
Add execution permissions to the conformance shell file.
The path for the known failures is wrong and needs to be corrected.
Errors out because skip has no argument
The proxy address needs to be set to where the test proxy is listening
The known failures should be added to the file so that those tests can be skipped
By putting all the test names on one line maybe they will all be picked up to be skipped rather than just one of them.
@danieljbruce danieljbruce marked this pull request as ready for review October 5, 2023 14:27
@danieljbruce danieljbruce added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 5, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 5, 2023
conformance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Choose a reason for hiding this comment

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

Is this needed? Looks like a duplicate of the step below

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 bet it's not needed, but I'm not completely sure. The PR in Java has this twice so I figured there must be a reason it is there https://github.com/googleapis/java-bigtable/pull/1699/files. I'll investigate further.

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've been informed by @liujiongxin this check is probably for the Java client repo itself.

Choose a reason for hiding this comment

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

Right, that makes sense. I forgot there were two repos involved!

path: cloud-bigtable-clients-test
- uses: actions/setup-node@v3
with:
node-version: 14

Choose a reason for hiding this comment

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

Do you think it would be useful to test with multiple node versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@@ -0,0 +1 @@
TestCheckAndMutateRow_NoRetry_TransientError\|TestCheckAndMutateRow_Generic_Headers\|TestCheckAndMutateRow_Generic_DeadlineExceeded\|TestMutateRow_Generic_Headers\|TestMutateRow_Generic_DeadlineExceeded\|TestMutateRows_Generic_CloseClient\|TestReadModifyWriteRow_Generic_Headers\|TestReadModifyWriteRow_NoRetry_TransientError\|TestReadModifyWriteRow_Generic_DeadlineExceeded\|TestReadRow_Generic_DeadlineExceeded\|TestReadRows_Retry_PausedScan\|TestReadRows_Retry_StreamReset\|TestMutateRows_Generic_DeadlineExceeded\|TestSampleRowKeys_Generic_Headers\|TestReadRows_Generic_DeadlineExceeded\|TestReadRows_Generic_CloseClient\|TestSampleRowKeys_Generic_DeadlineExceeded

Choose a reason for hiding this comment

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

I'm a little unsure if we should be skipping all these tests, maybe we should just let the test stay red until these are fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's look into this further.

Choose a reason for hiding this comment

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

We should have two test paths: default and all tests enabled.

Copy link
Contributor Author

@danieljbruce danieljbruce left a comment

Choose a reason for hiding this comment

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

Answer to review comments.

conformance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
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 bet it's not needed, but I'm not completely sure. The PR in Java has this twice so I figured there must be a reason it is there https://github.com/googleapis/java-bigtable/pull/1699/files. I'll investigate further.

path: cloud-bigtable-clients-test
- uses: actions/setup-node@v3
with:
node-version: 14
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@@ -0,0 +1 @@
TestCheckAndMutateRow_NoRetry_TransientError\|TestCheckAndMutateRow_Generic_Headers\|TestCheckAndMutateRow_Generic_DeadlineExceeded\|TestMutateRow_Generic_Headers\|TestMutateRow_Generic_DeadlineExceeded\|TestMutateRows_Generic_CloseClient\|TestReadModifyWriteRow_Generic_Headers\|TestReadModifyWriteRow_NoRetry_TransientError\|TestReadModifyWriteRow_Generic_DeadlineExceeded\|TestReadRow_Generic_DeadlineExceeded\|TestReadRows_Retry_PausedScan\|TestReadRows_Retry_StreamReset\|TestMutateRows_Generic_DeadlineExceeded\|TestSampleRowKeys_Generic_Headers\|TestReadRows_Generic_DeadlineExceeded\|TestReadRows_Generic_CloseClient\|TestSampleRowKeys_Generic_DeadlineExceeded
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's look into this further.

The conformance tests may catch more issues to do with streaming and such if more versions of node are covered.
@danieljbruce danieljbruce added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 5, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 5, 2023
cd $(dirname $0)/..

# Build and start the proxy in a separate process
pushd .

Choose a reason for hiding this comment

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

The pushd and popd shouldn't be necessary if you stay at the root

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What exactly would you suggest here if we eliminate pushd and popd? I tried subshells locally https://unix.stackexchange.com/questions/13802/execute-a-specific-command-in-a-given-directory-without-cding-to-it, but the command hangs.

Looking at this further, I think in the Java example we wanted to go back to the root because we wanted to run https://github.com/googleapis/java-bigtable/pull/1699/files#diff-08b007a16e10891ada78edba8173c7323e74500fa6e1600c5e1dc7a721df5388R62. Since we don't need to run anything else in this script after the golang tests however, I think we can eliminate pushd . and popd and not worry about staying at the root.

Choose a reason for hiding this comment

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

pushd and popd are only needed if you're changing directories. In the case of this specific block , it seems like a no-op, so yeah it makes sense to remove it

Alternatively, you could replace all the cd statements with pushd statements, which can be a lot cleaner if you have to move around the filesystem. But since this script is pretty simple, you can probably just stick with the cds you have

# Run the conformance test
pushd .
pwd
ls

Choose a reason for hiding this comment

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

was pwd and ls added for debugging? Can probably remove them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. These debugging commands have been removed now.

pwd and ls should not be left in the script
These two commands are unnecessary as nothing is run after them.
RETURN_CODE=$?

# Stop the proxy
kill $proxyPID
Copy link

Choose a reason for hiding this comment

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

This should be executed irrespective of when / how script exits. Exit traps can be used here. E.g. https://github.com/googleapis/google-cloud-go/blob/5de394be14cf852b99dde65fbeba3d02714f6845/storage/emulator_test.sh#L64-L70

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Makes sense. So would you suggest adding trap kill $proxyPID somewhere at the top of the file and removing this line? In that case would any exit signal still get propogated up to the user?

Copy link

Choose a reason for hiding this comment

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

Add a cleanup function.
Trap on EXIT signal which would catch any exit signal.

Similar to https://github.com/googleapis/google-cloud-go/blob/5de394be14cf852b99dde65fbeba3d02714f6845/storage/emulator_test.sh#L70

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Choose a reason for hiding this comment

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

Was the trap change pushed? I don't see the changes here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my git client at about 1:30 I made the changes and pushed them. Not sure why they don't show up.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is called "Add a cleanup operation"

As required, remove the list of known failures
The cleanup operation should happen no matter how the program exits.
@danieljbruce danieljbruce added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 11, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 11, 2023
@danieljbruce danieljbruce added the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 12, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 12, 2023
@danieljbruce danieljbruce merged commit 5cc0523 into googleapis:main Oct 12, 2023
15 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/nodejs-bigtable API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants