[go: nahoru, domu]

Skip to content

Commit

Permalink
test(spanner): fix spanner trace tests (#10253)
Browse files Browse the repository at this point in the history
* test(spanner): fix spanner trace tests

* Update cloud.google.com/go version

* fix go vet
  • Loading branch information
rahul2393 committed May 24, 2024
1 parent c87e1ab commit b058e85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
21 changes: 9 additions & 12 deletions spanner/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4548,12 +4548,11 @@ func TestClient_DoForEachRow_ShouldNotEndSpanWithIteratorDoneError(t *testing.T)
case <-time.After(1 * time.Second):
t.Fatal("No stats were exported before timeout")
}
// Preferably we would want to lock the TestExporter here, but the mutex TestExporter.mu is not exported, so we
// cannot do that.
if len(te.Spans) == 0 {
spans := te.Spans()
if len(spans) == 0 {
t.Fatal("No spans were exported")
}
s := te.Spans[len(te.Spans)-1].Status
s := spans[len(spans)-1].Status
if s.Code != int32(codes.OK) {
t.Errorf("Span status mismatch\nGot: %v\nWant: %v", s.Code, codes.OK)
}
Expand Down Expand Up @@ -4598,12 +4597,11 @@ func TestClient_DoForEachRow_ShouldEndSpanWithQueryError(t *testing.T) {
case <-time.After(1 * time.Second):
t.Fatal("No stats were exported before timeout")
}
// Preferably we would want to lock the TestExporter here, but the mutex TestExporter.mu is not exported, so we
// cannot do that.
if len(te.Spans) == 0 {
spans := te.Spans()
if len(spans) == 0 {
t.Fatal("No spans were exported")
}
s := te.Spans[len(te.Spans)-1].Status
s := spans[len(spans)-1].Status
if s.Code != int32(codes.InvalidArgument) {
t.Errorf("Span status mismatch\nGot: %v\nWant: %v", s.Code, codes.InvalidArgument)
}
Expand Down Expand Up @@ -5366,12 +5364,11 @@ func checkBatchWriteSpan(t *testing.T, errors []error, code codes.Code) {
case <-time.After(1 * time.Second):
t.Fatal("No stats were exported before timeout")
}
// Preferably we would want to lock the TestExporter here, but the mutex TestExporter.mu is not exported, so we
// cannot do that.
if len(te.Spans) == 0 {
spans := te.Spans()
if len(spans) == 0 {
t.Fatal("No spans were exported")
}
s := te.Spans[len(te.Spans)-1].Status
s := spans[len(spans)-1].Status
if s.Code != int32(code) {
t.Errorf("Span status mismatch\nGot: %v\nWant: %v", s.Code, code)
}
Expand Down
2 changes: 1 addition & 1 deletion spanner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module cloud.google.com/go/spanner
go 1.20

require (
cloud.google.com/go v0.113.0
cloud.google.com/go v0.114.0
cloud.google.com/go/iam v1.1.8
cloud.google.com/go/longrunning v0.5.7
github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions spanner/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRY
cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM=
cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I=
cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY=
cloud.google.com/go v0.113.0 h1:g3C70mn3lWfckKBiCVsAshabrDg01pQ0pnX1MNtnMkA=
cloud.google.com/go v0.113.0/go.mod h1:glEqlogERKYeePz6ZdkcLJ28Q2I6aERgDDErBg9GzO8=
cloud.google.com/go v0.114.0 h1:OIPFAdfrFDFO2ve2U7r/H5SwSbBzEdrBdE7xkgwc+kY=
cloud.google.com/go v0.114.0/go.mod h1:ZV9La5YYxctro1HTPug5lXH/GefROyW8PPD4T8n9J8E=
cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4=
cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw=
cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E=
Expand Down
2 changes: 1 addition & 1 deletion spanner/test/opentelemetry/test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replace (
)

require (
cloud.google.com/go v0.113.0
cloud.google.com/go v0.114.0
cloud.google.com/go/spanner v1.61.0
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
Expand Down

0 comments on commit b058e85

Please sign in to comment.