Skip to content

Commit

Permalink
fix(datastore): Add explicit sleep before read time use (#9080)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhshkh committed Dec 11, 2023
1 parent 90f584d commit 0538be4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datastore/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,10 @@ func TestIntegration_AggregationQueriesInTransaction(t *testing.T) {
if readTime.IsZero() {
// Use current time as read time if read time is not specified in test case
readTime = time.Now().Truncate(time.Microsecond)

// Read time is truncated to microseconds. If immediately used in NewTransaction call,
// it leads to "read_time cannot be in the future" error
time.Sleep(time.Second)
}

tx, err := client.NewTransaction(ctx, []TransactionOption{ReadOnly, WithReadTime(readTime)}...)
Expand Down

0 comments on commit 0538be4

Please sign in to comment.