|
|
@ -55,7 +55,12 @@ TEST(GcpObservabilityConfigJsonParsingTest, Basic) { |
|
|
|
"cloud_trace": { |
|
|
|
"cloud_trace": { |
|
|
|
"sampling_rate": 0.05 |
|
|
|
"sampling_rate": 0.05 |
|
|
|
}, |
|
|
|
}, |
|
|
|
"project_id": "project" |
|
|
|
"project_id": "project", |
|
|
|
|
|
|
|
"labels": { |
|
|
|
|
|
|
|
"SOURCE_VERSION": "v1", |
|
|
|
|
|
|
|
"SERVICE_NAME": "payment-service", |
|
|
|
|
|
|
|
"DATA_CENTER": "us-west1-a" |
|
|
|
|
|
|
|
} |
|
|
|
})json"; |
|
|
|
})json"; |
|
|
|
auto json = grpc_core::Json::Parse(json_str); |
|
|
|
auto json = grpc_core::Json::Parse(json_str); |
|
|
|
ASSERT_TRUE(json.ok()) << json.status(); |
|
|
|
ASSERT_TRUE(json.ok()) << json.status(); |
|
|
@ -88,6 +93,11 @@ TEST(GcpObservabilityConfigJsonParsingTest, Basic) { |
|
|
|
EXPECT_TRUE(config.cloud_trace.has_value()); |
|
|
|
EXPECT_TRUE(config.cloud_trace.has_value()); |
|
|
|
EXPECT_FLOAT_EQ(config.cloud_trace->sampling_rate, 0.05); |
|
|
|
EXPECT_FLOAT_EQ(config.cloud_trace->sampling_rate, 0.05); |
|
|
|
EXPECT_EQ(config.project_id, "project"); |
|
|
|
EXPECT_EQ(config.project_id, "project"); |
|
|
|
|
|
|
|
EXPECT_THAT(config.labels, |
|
|
|
|
|
|
|
::testing::UnorderedElementsAre( |
|
|
|
|
|
|
|
::testing::Pair("SOURCE_VERSION", "v1"), |
|
|
|
|
|
|
|
::testing::Pair("SERVICE_NAME", "payment-service"), |
|
|
|
|
|
|
|
::testing::Pair("DATA_CENTER", "us-west1-a"))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST(GcpObservabilityConfigJsonParsingTest, Defaults) { |
|
|
|
TEST(GcpObservabilityConfigJsonParsingTest, Defaults) { |
|
|
@ -103,6 +113,7 @@ TEST(GcpObservabilityConfigJsonParsingTest, Defaults) { |
|
|
|
EXPECT_FALSE(config.cloud_monitoring.has_value()); |
|
|
|
EXPECT_FALSE(config.cloud_monitoring.has_value()); |
|
|
|
EXPECT_FALSE(config.cloud_trace.has_value()); |
|
|
|
EXPECT_FALSE(config.cloud_trace.has_value()); |
|
|
|
EXPECT_TRUE(config.project_id.empty()); |
|
|
|
EXPECT_TRUE(config.project_id.empty()); |
|
|
|
|
|
|
|
EXPECT_TRUE(config.labels.empty()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST(GcpObservabilityConfigJsonParsingTest, LoggingConfigMethodIllegalSlashes) { |
|
|
|
TEST(GcpObservabilityConfigJsonParsingTest, LoggingConfigMethodIllegalSlashes) { |
|
|
|