@@ -172,6 +172,12 @@ REMOTE_CONFIG_TEST("response processing") {
172
172
"client_configs": ["employee/APM_TRACING/valid_conf_path/config"],
173
173
"target_files": [{"path": "employee/APM_TRACING/valid_conf_path/config", "raw": "eyJmb28iOiAiYmFyIn0="}]
174
174
})" ,
175
+ // / invalid configuration path
176
+ R"( {
177
+ "targets": "eyJzaWduZWQiOiB7InZlcnNpb24iOiAyLCAidGFyZ2V0cyI6IHsiZW1wbG95ZWUvQVBNX1RSQUNJTkcvdmFsaWRfY29uZl9wYXRoL2NvbmZpZyI6IHt9LCAiYmFyIjoge319LCJjdXN0b20iOiB7Im9wYXF1ZV9iYWNrZW5kX3N0YXRlIjogIjE1In19fQ==",
178
+ "client_configs": ["foo"],
179
+ "target_files": [{"path": "foo", "raw": "eyJmb28iOiAiYmFyIn0="}]
180
+ })" ,
175
181
}));
176
182
// clang-format on
177
183
@@ -191,8 +197,10 @@ REMOTE_CONFIG_TEST("response processing") {
191
197
CHECK (payload.contains (" /client/state/has_error" _json_pointer) == true );
192
198
CHECK (payload.contains (" /client/state/error" _json_pointer) == true );
193
199
194
- // targets_version should not have been updated.
200
+ // `targets_version` and `backend_client_state` should not have been
201
+ // updated.
195
202
CHECK (payload[" client" ][" state" ][" targets_version" ] == 0 );
203
+ CHECK (payload[" client" ][" state" ][" backend_client_state" ] == " " );
196
204
}
197
205
198
206
SECTION (" update dispatch" ) {
@@ -252,8 +260,22 @@ REMOTE_CONFIG_TEST("response processing") {
252
260
CHECK (agent_listener->count_on_revert == 0 );
253
261
CHECK (agent_listener->count_on_post_process == 1 );
254
262
255
- SECTION (" config states are reported on next payload " ) {
263
+ SECTION (" next request payload is correctly populated " ) {
256
264
const auto payload = rc.make_request_payload ();
265
+
266
+ // Verify client state is reported
267
+ REQUIRE (payload.contains (" /client/state" _json_pointer) == true );
268
+ const auto & client_state = payload.at (" /client/state" _json_pointer);
269
+ CHECK (client_state.at (" targets_version" ) == 66204320 );
270
+ CHECK (
271
+ client_state.at (" backend_client_state" ) ==
272
+ " eyJ2ZXJzaW9uIjoyLCJzdGF0ZSI6eyJmaWxlX2hhc2hlcyI6eyJkYXRhZG9nLzEwMDAx"
273
+ " MjU4NDAvQVBNX1RSQUNJTkcvODI3ZWFjZjhkYmMzYWIxNDM0ZDMyMWNiODFkZmJmN2Fm"
274
+ " ZTY1NGE0YjYxMTFjZjE2NjBiNzFjY2Y4OTc4MTkzOC8yOTA4NmJkYmU1MDZlNjhiNTBm"
275
+ " MzA1NTgyM2EzZGE1Y2UwNTI4ZjE2NDBkNTJjZjg4NjE4MTZhYWE5ZmNlYWY0IjpbIm9Y"
276
+ " ZDJpeUMzeC9oRWsxeXVhY1hGN1lqcXJpTk9BWUtuZzFtWE01NVZKTHc9Il19fX0=" );
277
+
278
+ // Verify config states are reported
257
279
REQUIRE (payload.contains (" /client/state/config_states" _json_pointer) ==
258
280
true );
259
281
@@ -273,36 +295,25 @@ REMOTE_CONFIG_TEST("response processing") {
273
295
CHECK (!config_state.contains (" apply_error" ));
274
296
}
275
297
}
276
- }
277
-
278
- SECTION (" cached_target_files is correctly populated" ) {
279
- auto payload = rc.make_request_payload ();
280
298
299
+ // Verify `cached_target_files` is reported
281
300
auto cached_target_files = payload.find (" cached_target_files" );
282
301
REQUIRE (cached_target_files != payload.end ());
283
-
284
302
REQUIRE (cached_target_files->is_array ());
285
303
REQUIRE (cached_target_files->size () == 3 );
286
304
287
- std::sort (cached_target_files->begin (), cached_target_files->end (),
288
- [](const auto & a, const auto & b) {
289
- return a.at (" path" ).template get <std::string_view>() <
290
- b.at (" path" ).template get <std::string_view>();
291
- });
292
-
293
305
const auto ctf = cached_target_files->at (0 );
294
- REQUIRE (ctf.at (" path" ).get <std::string_view>() ==
295
- " employee/AGENT_CONFIG/test_rc_update/flare_conf" );
296
- REQUIRE (ctf.at (" length" ).get <std::uint64_t >() == 381UL );
306
+ CHECK (ctf.at (" path" ).get <std::string_view>() ==
307
+ " employee/AGENT_CONFIG/test_rc_update/flare_conf" );
308
+ CHECK (ctf.at (" length" ).get <std::uint64_t >() == 381UL );
297
309
298
310
auto hashes = ctf.at (" hashes" );
299
-
300
311
REQUIRE (hashes.is_array ());
301
312
REQUIRE (hashes.size () == 1 );
302
313
303
314
const auto h = hashes.at (0 );
304
- REQUIRE (h.at (" algorithm" ).get <std::string_view>() == " sha256" );
305
- REQUIRE (h.at (" hash" ).get <std::string_view>().size () == 64U );
315
+ CHECK (h.at (" algorithm" ).get <std::string_view>() == " sha256" );
316
+ CHECK (h.at (" hash" ).get <std::string_view>().size () == 64U );
306
317
}
307
318
308
319
SECTION (" same config update should not trigger listeners" ) {
0 commit comments