Skip to content

Commit

Permalink
test(spanner): relax an expectation about JSON keys in emulator (#7517)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
devbww authored Oct 26, 2021
1 parent 0cd97d7 commit 38959b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down

0 comments on commit 38959b4

Please sign in to comment.