From 1513106ba51540aef11a264d09e73f24350ad95b Mon Sep 17 00:00:00 2001 From: rahul2393 Date: Fri, 27 Dec 2024 10:48:04 +0530 Subject: [PATCH] test(spanner): skip failing tests on cloud-devel and staging (#11347) * test(spanner): skip failing tests on cloud-devel and staging * updated asserts to check for contains since we now are returning requestID with error message --- spanner/integration_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spanner/integration_test.go b/spanner/integration_test.go index 1988e40babf0..a2b441621f03 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() @@ -5332,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() @@ -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.")