Skip to content

chore(x-goog-spanner-request-id): setup expectations for end-to-end request-id checks #3932

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

Conversation

odeke-em
Copy link
Contributor

This change allows us to perform future end-to-end checks to assert on the behaviour of x-goog-spanner-request-id header values.

Updates #3537

@odeke-em odeke-em requested review from a team as code owners June 29, 2025 06:21
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner API. labels Jun 29, 2025
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 29, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 29, 2025
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Jul 8, 2025
@odeke-em odeke-em force-pushed the x-goog-spanner-request-id-setup-e2e-expectations branch from 2af5841 to 14190fe Compare July 8, 2025 10:24
@odeke-em
Copy link
Contributor Author

odeke-em commented Jul 8, 2025

@olavloite @rahul2393 @sakthivelmanii @surbhigarg92 kindly help me run the bots!

@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 8, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 8, 2025
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 10, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 10, 2025
odeke-em added 3 commits July 14, 2025 17:42
…equest-id checks

This change allows us to perform future end-to-end checks to assert
on the behaviour of x-goog-spanner-request-id header values.

Updates googleapis#3537
@odeke-em odeke-em force-pushed the x-goog-spanner-request-id-setup-e2e-expectations branch from 197415f to abb5f5d Compare July 14, 2025 15:01
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jul 14, 2025
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 29, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 29, 2025
Copy link
Collaborator

@olavloite olavloite left a comment

Choose a reason for hiding this comment

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

Please address any comments in a follow-up PR.

Comment on lines +188 to +190
for (int i = 0; i < gotUnaryValues.length && false; i++) {
System.out.println("\033[33misUnary: #" + i + ":: " + gotUnaryValues[i] + "\033[00m");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand that this is not being printed due to the && false condition in the loop, but can we add a TODO that this should be removed in a follow-up PR.


public void checkExpectedUnaryXGoogRequestIds(MethodAndRequestId... wantUnaryValues) {
MethodAndRequestId[] gotUnaryValues = this.accumulatedUnaryValues();
sortValues(gotUnaryValues);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it correct that we are sorting these accumulated values here? Doesn't that mean that if we receive the request-ids out of the expected order on the (mock) server, this sort action hides any potential test failures due to the request-ids having been out of order?


public void checkAtLeastHasExpectedUnaryXGoogRequestIds(MethodAndRequestId... wantUnaryValues) {
MethodAndRequestId[] gotUnaryValues = this.accumulatedUnaryValues();
sortValues(gotUnaryValues);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here regarding sorting the accumulated values as above.

@@ -223,7 +223,7 @@ DatabaseId getDatabaseId() {
@Override
public XGoogSpannerRequestId nextRequestId(long channelId, int attempt) {
return XGoogSpannerRequestId.of(
this.nthId, this.nthRequest.incrementAndGet(), channelId, attempt);
this.nthId, channelId, this.nthRequest.incrementAndGet(), attempt);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The fact that we can make this change without any tests failing (or needing to be changed) seems to indicate that we have a test gap. Will that be covered by the tests that are being added in this PR, but that are currently not verifying anything, as all verifications are in if (false) blocks? If not, can we add tests that cover this in a follow-up PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@olavloite I had made a much larger PR #3915 in which tests were all updated but deemed too large to get in at once hence I carved this one out. Indeed @tharoldD is sending a follow-up PR to remove all the false conditions and then more tests too.

@olavloite olavloite merged commit 71cda80 into googleapis:main Jul 29, 2025
38 of 40 checks passed
@odeke-em odeke-em deleted the x-goog-spanner-request-id-setup-e2e-expectations branch July 29, 2025 13:47
@odeke-em
Copy link
Contributor Author

Thank you for the code reviews and merge @rahul2393 and @olavloite! @tharoldD, we are now free to send the respective PR updates and tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants