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

Fix SpannerChangeStreamErrorTest.java and stop disabling tests #28751

Merged
merged 4 commits into from
Oct 4, 2023

Conversation

nancyxu123
Copy link
Contributor

Fix error expectations in SpannerChangeStreamErrorTest.

UNAVAILABLE / ABORTED codes are always retried, so they should have the short retry settings only. Otherwise, if you use the default timeout (i.e. 2 hours), the test will timeout.

Copy link
Member

@kennknowles kennknowles left a comment

Choose a reason for hiding this comment

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

I don't have enough context on this to know what the best outcome for these tests is. Since you have more knowledge I trust it. I have done a basic code review. I will check the test results and whatnot.

// databaseClient.getDialect does not currently bubble up the correct message.
// Instead, the error returned is: "DEADLINE_EXCEEDED: Operation did not complete "
// "in the given time"
thrown.expectMessage("RESOURCE_EXHAUSTED - Statement: 'SELECT 'POSTGRESQL' AS DIALECT");
thrown.expectMessage("DEADLINE_EXCEEDED: Operation did not complete in the given time");
Copy link
Member

Choose a reason for hiding this comment

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

It would be fine to make this a flexible match, perhaps just DEADLINE_EXCEEDED. The correctness of SpannerChangeStream does not depend on the details. And same comment for all error message matching.

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 thing, done.

@@ -300,9 +330,19 @@ public void testInvalidRecordReceived() {
mockInvalidChangeStreamRecordReceived(startTimestamp, endTimestamp);

try {
final SpannerConfig changeStreamConfig =
SpannerConfig.create()
Copy link
Member

Choose a reason for hiding this comment

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

Positive comment - inlining the config also makes the test better, as the setup should be inline with the result. Great.

thrown.expectMessage("Field not found");
assertThat(
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.equalTo(0));
mockSpannerService.countRequestsOfType(ExecuteSqlRequest.class), Matchers.greaterThan(0));
Copy link
Member

Choose a reason for hiding this comment

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

This is a behavior change from expecting 0 to expecting great than 0. Just noting this. I don't have a strong opinion about it.

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 think the behavior change is fine, since previously this test was disabled, so I'm not exactly sure which part was broken.

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@kennknowles
Copy link
Member

We disabled the troublesome tests but I think you need to rebase or merge in master branch to get those changes.

@nancyxu123
Copy link
Contributor Author

We disabled the troublesome tests but I think you need to rebase or merge in master branch to get those changes.

Done!

@kennknowles
Copy link
Member

Everything succeeded but it failed to publish the JUnit test results. Actually I don't know if that means the tests succeeded, just that running the tests succeeded.

@nancyxu123
Copy link
Contributor Author

Everything succeeded but it failed to publish the JUnit test results. Actually I don't know if that means the tests succeeded, just that running the tests succeeded.

Hi, I tried rerunning the SpannerChangeStreamErrorTest locally and it passes. Do you know what could cause the failure to publish the Junit test results?

@kennknowles
Copy link
Member

I figured it was transient, so I re-ran the failed job. If it is failing all the time it is probably a GHA bug (in our configs I would guess)

@kennknowles
Copy link
Member

I'm re-running it one more time and pinging @damccorm who is our resident GHA expert :-)

@damccorm
Copy link
Contributor

damccorm commented Oct 4, 2023

Not sure about the cause of the publishing failures, but the build did succeed and ran the tests (see build scan - https://ge.apache.org/s/e7yiokl4fbixq/tests/overview). Lets see if the publishing issues are transient, if not we can dig in independently from this PR

@kennknowles
Copy link
Member

Noting that the publishing did fail in two consecutive runs on this PR. So the current run would represent 3 consecutive failures so hopefully we can then isolate the problem. I mean hopefully it was transient and all fixed and never happens again, but... :-)

@kennknowles
Copy link
Member

yea same issue

@damccorm
Copy link
Contributor

damccorm commented Oct 4, 2023

Ah, this is already fixed on master - https://github.com/apache/beam/actions/workflows/beam_PreCommit_Java_GCP_IO_Direct.yml?query=event%3Aschedule - we're just seeing it on retries because retries grab the same merge commit

@damccorm
Copy link
Contributor

damccorm commented Oct 4, 2023

This is safe to merge

@damccorm damccorm merged commit 9efdf6b into apache:master Oct 4, 2023
17 of 18 checks passed
@nancyxu123
Copy link
Contributor Author

This is safe to merge

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants