Skip to content

Commit 1568227

Browse files
committed
CBD-6348: [BP] Fix problems with nlohmann and gtest
When building in C++20 mode there is some problems with the version we have with gtest and nlohmann to implicit conversion to the correct type. Change-Id: Iad17e276b8fbc0b5945fabbe4acdd0e7619ce925 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/234990 Well-Formed: Restriction Checker Tested-by: Trond Norbye <[email protected]> Reviewed-by: Mohammad Zaeem <[email protected]>
1 parent cdae172 commit 1568227

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

tests/testapp/auth_provider_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ TEST_F(AuthProviderTest, UnsupportedMech) {
8282
R"({"mechanism":"SCRAM-SHA1", "challenge":"foo", "authentication-only":false})");
8383
ASSERT_EQ(cb::mcbp::Status::NotSupported, ret.first);
8484
const auto json = nlohmann::json::parse(ret.second);
85-
EXPECT_EQ("mechanism not supported", json["error"]["context"]);
85+
EXPECT_EQ("mechanism not supported",
86+
json["error"]["context"].get<std::string>());
8687
}
8788

8889
TEST_F(AuthProviderTest, NoChallenge) {

tests/testapp/testapp_interfaces.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ TEST_P(InterfacesTest, Prometheus) {
169169
EXPECT_TRUE(config["port"].is_number());
170170
EXPECT_LT(0, config["port"]);
171171
EXPECT_EQ("prometheus", config["type"]);
172-
EXPECT_NE(uuid, config["uuid"]);
172+
EXPECT_NE(uuid, config["uuid"].get<std::string>());
173173
uuid = config["uuid"];
174174

175175
interfaces = getInterfaces(*adminConnection);
176-
ASSERT_EQ(uuid, interfaces.back()["uuid"])
176+
ASSERT_EQ(uuid, interfaces.back()["uuid"].get<std::string>())
177177
<< "list interfaces should return the newly created interface";
178178
}
179179

@@ -329,7 +329,7 @@ TEST_P(InterfacesTest, TlsPropertiesEncryptedKey) {
329329
ASSERT_TRUE(rsp.isSuccess()) << to_string(rsp.getStatus()) << std::endl
330330
<< rsp.getDataString();
331331
auto json = rsp.getDataJson();
332-
EXPECT_EQ("set", json["password"]) << json.dump(2);
332+
EXPECT_EQ("set", json["password"].get<std::string>()) << json.dump(2);
333333
}
334334

335335
TEST_P(InterfacesTest, TlsPropertiesEncryptedCertInvalidPassphrase) {

tests/testapp/testapp_rbac.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ TEST_P(RbacTest, MB23909_ErrorIncudingErrorInfo) {
134134
const std::string expected{
135135
"Authorization failure: can't execute RBAC_REFRESH operation "
136136
"without the SecurityManagement privilege"};
137-
EXPECT_EQ(expected, json["error"]["context"]);
137+
EXPECT_EQ(expected, json["error"]["context"].get<std::string>());
138138
}
139139

140140
class RbacRoleTest : public TestappClientTest {

0 commit comments

Comments
 (0)