Skip to content

Commit 239abcd

Browse files
ci(spanner): Fix directpath nightly jobs in spanner (#12607)
* ci(spanner): Fix directpath nightly jobs in spanner * Fix formatting
1 parent 7ce8863 commit 239abcd

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

spanner/integration_test.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,6 +3675,8 @@ func TestIntegration_ReadErrors(t *testing.T) {
36753675
// Test TransactionRunner. Test that transactions are aborted and retried as
36763676
// expected.
36773677
func TestIntegration_TransactionRunner(t *testing.T) {
3678+
// TODO(sakthivelmani): Enable the tests once b/422916293 is fixed
3679+
skipDirectPathTest(t)
36783680
skipEmulatorTest(t)
36793681
t.Parallel()
36803682

@@ -5893,11 +5895,7 @@ func TestIntegration_Foreign_Key_Delete_Cascade_Action(t *testing.T) {
58935895
}
58945896

58955897
func TestIntegration_GFE_Latency(t *testing.T) {
5896-
if directPathEnabled, found := os.LookupEnv("GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS"); found {
5897-
if enabled, _ := strconv.ParseBool(directPathEnabled); enabled {
5898-
t.Skip("Skipping GFE tests when DirectPath is enabled")
5899-
}
5900-
}
5898+
skipDirectPathTest(t)
59015899
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
59025900
defer cancel()
59035901

@@ -6770,6 +6768,14 @@ func skipEmulatorTest(t *testing.T) {
67706768
}
67716769
}
67726770

6771+
func skipDirectPathTest(t *testing.T) {
6772+
if directPathEnabled, found := os.LookupEnv("GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS"); found {
6773+
if enabled, _ := strconv.ParseBool(directPathEnabled); enabled {
6774+
t.Skip("Skipping GFE tests when DirectPath is enabled")
6775+
}
6776+
}
6777+
}
6778+
67736779
func skipUnsupportedPGTest(t *testing.T) {
67746780
if testDialect == adminpb.DatabaseDialect_POSTGRESQL {
67756781
t.Skip("Skipping testing of unsupported tests in Postgres dialect.")

spanner/regression_test.go

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import (
1919
"errors"
2020
"fmt"
2121
"maps"
22+
"os"
2223
"slices"
2324
"sort"
25+
"strconv"
2426
"testing"
2527

2628
sppb "cloud.google.com/go/spanner/apiv1/spannerpb"
@@ -60,6 +62,11 @@ func (oi *ourInterceptor) interceptUnary(ctx context.Context, req any, usi *grpc
6062
return handler(ctx, req)
6163
}
6264

65+
func directPathEnabled() bool {
66+
enabled, _ := strconv.ParseBool(os.Getenv("GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS"))
67+
return enabled
68+
}
69+
6370
// This is a regression test to assert that all the expected headers are propagated
6471
// along to the final gRPC server avoiding scenarios where headers got dropped from a
6572
// destructive context augmentation call.
@@ -138,36 +145,41 @@ func TestAllHeadersForwardedAppropriately(t *testing.T) {
138145
WantHeaders []string
139146
}
140147

148+
var dynamicHeaders []string
149+
if directPathEnabled() {
150+
dynamicHeaders = []string{"x-goog-spanner-enable-afe-server-timing"}
151+
}
152+
141153
wantUnaryExpectations := []*headerExpectation{
142154
{
143155
"/google.spanner.v1.Spanner/BatchCreateSessions",
144-
[]string{
156+
append([]string{
145157
":authority", "content-type", "google-cloud-resource-prefix",
146158
"grpc-accept-encoding", "user-agent", "x-goog-api-client",
147159
"x-goog-request-params", "x-goog-spanner-end-to-end-tracing",
148160
"x-goog-spanner-request-id", "x-goog-spanner-route-to-leader",
149-
},
161+
}, dynamicHeaders...),
150162
},
151163
{
152164
"/google.spanner.v1.Spanner/BeginTransaction",
153-
[]string{
165+
append([]string{
154166
":authority", "content-type", "google-cloud-resource-prefix",
155167
"grpc-accept-encoding", "user-agent", "x-goog-api-client",
156168
"x-goog-request-params", "x-goog-spanner-end-to-end-tracing",
157169
"x-goog-spanner-request-id",
158-
},
170+
}, dynamicHeaders...),
159171
},
160172
}
161173

162174
wantStreamingExpectations := []*headerExpectation{
163175
{
164176
"/google.spanner.v1.Spanner/ExecuteStreamingSql",
165-
[]string{
177+
append([]string{
166178
":authority", "content-type", "google-cloud-resource-prefix",
167179
"grpc-accept-encoding", "user-agent", "x-goog-api-client",
168180
"x-goog-request-params", "x-goog-spanner-end-to-end-tracing",
169181
"x-goog-spanner-request-id",
170-
},
182+
}, dynamicHeaders...),
171183
},
172184
}
173185

0 commit comments

Comments
 (0)