Skip to content

Commit

Permalink
Add simulation time for BatchCreateSession.
Browse files Browse the repository at this point in the history
  • Loading branch information
hengfengli committed Jun 15, 2020
1 parent 8f8e58b commit 66b9cc6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spanner/oc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"cloud.google.com/go/internal/testutil"
"cloud.google.com/go/internal/version"
stestutil "cloud.google.com/go/spanner/internal/testutil"
"go.opencensus.io/stats/view"
"go.opencensus.io/tag"
)
Expand Down Expand Up @@ -176,9 +177,14 @@ func TestOCStats_SessionPool_GetSessionTimeoutsCount(t *testing.T) {
te := testutil.NewTestExporter(GetSessionTimeoutsCountView)
defer te.Unregister()

_, client, teardown := setupMockedTestServer(t)
server, client, teardown := setupMockedTestServer(t)
defer teardown()

server.TestSpanner.PutExecutionTime(stestutil.MethodBatchCreateSession,
stestutil.SimulatedExecutionTime{
MinimumExecutionTime: 2 * time.Millisecond,
})

ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond)
defer cancel()
client.Single().ReadRow(ctx, "Users", Key{"alice"}, []string{"email"})
Expand Down

0 comments on commit 66b9cc6

Please sign in to comment.