python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

spanner.cloud-client.snippets_test: test_query_data_with_timestamp_parameter failed

Open flaky-bot[bot] opened this issue 6 years ago • 10 comments

Note: #3543 was also for this test, but it was closed more than 10 days ago. So, I didn't mark it flaky.


commit: 3680196d8b1fbcb576210cb2219eba9cdcac3f28 buildURL: Build Status, Sponge status: failed

Test output
Traceback (most recent call last):
  File "/workspace/spanner/cloud-client/snippets_test.py", line 358, in test_query_data_with_timestamp_parameter
    assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in out
AssertionError: assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in ''

flaky-bot[bot] avatar Jun 29 '20 09:06 flaky-bot[bot]

Looks like this issue is flaky. :worried:

I'm going to leave this open and stop commenting.

A human should fix and close this.


When run at the same commit (3680196d8b1fbcb576210cb2219eba9cdcac3f28), this test passed in one build (Build Status, Sponge) and failed in another build (Build Status, Sponge).

flaky-bot[bot] avatar Jun 29 '20 11:06 flaky-bot[bot]

I'm not 100% confident, but the spanner tests has the following code:

def unique_database_id():
    """ Creates a unique id for the database. """
    return 'test-db-{}'.format(''.join(random.choice(
        string.ascii_lowercase + string.digits) for _ in range(5)))

Is it possible that on multiple machines, random gets the same seed then we get the same random id?

Anyways, maybe we can just use uuid4.

tmatsuo avatar Jun 29 '20 18:06 tmatsuo

Oops! Looks like this issue is still flaky. It failed again. :grimacing:

I reopened the issue, but a human will need to close it again.


commit: 51a66f94512b1416dcf0a02de5b787a808419f4d buildURL: Build Status, Sponge status: failed

Test output
Traceback (most recent call last):
  File "/workspace/spanner/cloud-client/snippets_test.py", line 356, in test_query_data_with_timestamp_parameter
    assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in out
AssertionError: assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in ''

flaky-bot[bot] avatar Jul 03 '20 10:07 flaky-bot[bot]

Needs more investigation

tmatsuo avatar Jul 06 '20 23:07 tmatsuo

@larkee

test_query_data_with_timestamp_parameter occasionally fails. The output seems empty.

Do you have any idea why this is happening?

tmatsuo avatar Jul 08 '20 23:07 tmatsuo

There was a similar issue in Go: https://github.com/GoogleCloudPlatform/golang-samples/issues/1146

Basically, a time drift can happen between local machine and spanner servers. insert_datatypes_data uses the spanner server time for the commit timestamp while query_data_with_timestamp_parameter uses the local server time. This means if not enough time has passed, the local server time could still be less than the commit time which means no results are returned.

To resolve this, a sleep delay needs to be added. I'll create the PR now.

larkee avatar Jul 13 '20 08:07 larkee

Oops! Looks like this issue is still flaky. It failed again. :grimacing:

I reopened the issue, but a human will need to close it again.


commit: 3e552692af2cba77eb8462a7fb6c4228579397f1 buildURL: Build Status, Sponge status: failed

Test output
Traceback (most recent call last):
  File "/workspace/spanner/cloud-client/snippets_test.py", line 371, in test_query_data_with_timestamp_parameter
    assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in out
AssertionError: assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in ''

flaky-bot[bot] avatar Jul 20 '20 10:07 flaky-bot[bot]

Potentially we need longer sleep. Can we just use the future time instead of using the current time in the sample code?

tmatsuo avatar Jul 20 '20 19:07 tmatsuo

I haven't seen this flake for a while. I'll close this and take care of it when we see this again.

tmatsuo avatar Aug 05 '20 19:08 tmatsuo

Oops! Looks like this issue is still flaky. It failed again. :grimacing:

I reopened the issue, but a human will need to close it again.


commit: 2c0d10c2770c48b1944c2821a0475aa5bef51cc1 buildURL: Build Status, Sponge status: failed

Test output
Traceback (most recent call last):
  File "/workspace/spanner/cloud-client/snippets_test.py", line 371, in test_query_data_with_timestamp_parameter
    assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in out
AssertionError: assert 'VenueId: 4, VenueName: Venue 4, LastUpdateTime:' in ''

flaky-bot[bot] avatar Aug 10 '20 09:08 flaky-bot[bot]