From a0de7693baffcc3cb7a6344a8b969e4369c76b4a Mon Sep 17 00:00:00 2001 From: rahul yadav Date: Tue, 24 Dec 2024 11:41:01 +0530 Subject: [PATCH 1/2] test(spanner): skip failing tests on cloud-devel and staging --- spanner/integration_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spanner/integration_test.go b/spanner/integration_test.go index 1988e40babf0..422adef5342e 100644 --- a/spanner/integration_test.go +++ b/spanner/integration_test.go @@ -859,6 +859,8 @@ func TestIntegration_SingleUse_WithQueryOptions(t *testing.T) { func TestIntegration_TransactionWasStartedInDifferentSession(t *testing.T) { t.Parallel() + // TODO: unskip once https://b.corp.google.com/issues/309745482 is fixed + skipOnNonProd(t) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() @@ -6220,6 +6222,13 @@ func skipUnsupportedPGTest(t *testing.T) { } } +func skipOnNonProd(t *testing.T) { + job := os.Getenv("JOB_TYPE") + if strings.Contains(job, "cloud-devel") || strings.Contains(job, "cloud-staging") { + t.Skip("Skipping test on non-production environment.") + } +} + func onlyRunForPGTest(t *testing.T) { if testDialect != adminpb.DatabaseDialect_POSTGRESQL { t.Skip("Skipping tests supported only in Postgres dialect.") From 0813fb37ed53dfad210eb5a393bd3644bb621bd5 Mon Sep 17 00:00:00 2001 From: rahul yadav Date: Tue, 24 Dec 2024 13:23:06 +0530 Subject: [PATCH 2/2] updated asserts to check for contains since we now are returning requestID with error message --- spanner/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spanner/integration_test.go b/spanner/integration_test.go index 422adef5342e..a2b441621f03 100644 --- a/spanner/integration_test.go +++ b/spanner/integration_test.go @@ -5334,7 +5334,7 @@ func TestIntegration_Foreign_Key_Delete_Cascade_Action(t *testing.T) { t.Run(tt.name, func(t *testing.T) { gotErr := tt.test() // convert the error to lower case because resource names are in lower case for PG dialect. - if gotErr != nil && !strings.EqualFold(gotErr.Error(), tt.wantErr.Error()) { + if gotErr != nil && !strings.Contains(gotErr.Error(), tt.wantErr.Error()) { t.Errorf("FKDC error=%v, wantErr: %v", gotErr, tt.wantErr) } else { tt.validate()