From 38959b40c948207854f033127c695bcbf1477cef Mon Sep 17 00:00:00 2001 From: Bradley White <14679271+devbww@users.noreply.github.com> Date: Tue, 26 Oct 2021 13:37:36 -0400 Subject: [PATCH] test(spanner): relax an expectation about JSON keys in emulator (#7517) The Spanner emulator is gaining support for JSON values, which means we need to start changing some test expectations. We were somewhat particular about what errors to expect so that we could discern when the emulator's behavior started to change. In this test case, where we use a JSON column as a primary key (which is always an error), we were expecting a parse error on the word "JSON", but, for now, we're happy with any kind of error. We might still get the "INVALID_ARGUMENT" parsing error, or we could get the true "INVALID_ARGUMENT" primary-key error, or we might even get "UNIMPLEMENTED" if the emulator has JSON support dynamically disabled. --- .../admin/integration_tests/database_admin_integration_test.cc | 3 +-- .../integration_tests/database_admin_integration_test.cc | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/google/cloud/spanner/admin/integration_tests/database_admin_integration_test.cc b/google/cloud/spanner/admin/integration_tests/database_admin_integration_test.cc index a7a779c1eb23c..002bb2fc0180a 100644 --- a/google/cloud/spanner/admin/integration_tests/database_admin_integration_test.cc +++ b/google/cloud/spanner/admin/integration_tests/database_admin_integration_test.cc @@ -275,8 +275,7 @@ TEST_F(DatabaseAdminClientTest, DatabaseBasicCRUD) { AllOf(HasSubstr("Key has type JSON"), HasSubstr("part of the primary key")))); } else { - EXPECT_THAT(metadata, StatusIs(StatusCode::kInvalidArgument, - HasSubstr("Encountered 'JSON'"))); + EXPECT_THAT(metadata, Not(IsOk())); } EXPECT_TRUE(DatabaseExists()) << "Database " << database_; diff --git a/google/cloud/spanner/integration_tests/database_admin_integration_test.cc b/google/cloud/spanner/integration_tests/database_admin_integration_test.cc index 39c33f2b358df..cdae05660bde3 100644 --- a/google/cloud/spanner/integration_tests/database_admin_integration_test.cc +++ b/google/cloud/spanner/integration_tests/database_admin_integration_test.cc @@ -268,8 +268,7 @@ TEST_F(DatabaseAdminClientTest, DatabaseBasicCRUD) { AllOf(HasSubstr("Key has type JSON"), HasSubstr("part of the primary key")))); } else { - EXPECT_THAT(metadata, StatusIs(StatusCode::kInvalidArgument, - HasSubstr("Encountered 'JSON'"))); + EXPECT_THAT(metadata, Not(IsOk())); } EXPECT_TRUE(DatabaseExists()) << "Database " << database_;