blob: fab6745c3b8c616210852e5eb267a99d8f91bff8 [file] [log] [blame]
Austin Schuhcb108412019-10-13 16:09:54 -07001#include "aos/configuration.h"
2
3#include "absl/strings/strip.h"
4#include "aos/json_to_flatbuffer.h"
5#include "aos/testing/test_logging.h"
6#include "aos/util/file.h"
Alex Perrycb7da4b2019-08-28 19:35:56 -07007#include "flatbuffers/reflection.h"
8#include "glog/logging.h"
Austin Schuhcb108412019-10-13 16:09:54 -07009#include "gtest/gtest.h"
10
11namespace aos {
12namespace configuration {
13namespace testing {
14
15class ConfigurationTest : public ::testing::Test {
16 public:
17 ConfigurationTest() { ::aos::testing::EnableTestLogging(); }
18};
19
20typedef ConfigurationTest ConfigurationDeathTest;
21
22// *the* expected location for all working tests.
23const char *kExpectedLocation =
24 "{ \"name\": \"/foo\", \"type\": \".aos.bar\", \"max_size\": 5 }";
Austin Schuhbca6cf02019-12-22 17:28:34 -080025// And for multinode setups
26const char *kExpectedMultinodeLocation =
27 "{ \"name\": \"/foo\", \"type\": \".aos.bar\", \"max_size\": 5, \"source_node\": \"pi1\" }";
Austin Schuhcb108412019-10-13 16:09:54 -070028
29// Tests that we can read and merge a configuration.
30TEST_F(ConfigurationTest, ConfigMerge) {
Austin Schuh40485ed2019-10-26 21:51:44 -070031 FlatbufferDetachedBuffer<Configuration> config =
32 ReadConfig("aos/testdata/config1.json");
Alex Perrycb7da4b2019-08-28 19:35:56 -070033 LOG(INFO) << "Read: " << FlatbufferToJson(config, true);
Austin Schuhcb108412019-10-13 16:09:54 -070034
35 EXPECT_EQ(
36 absl::StripSuffix(
37 util::ReadFileToStringOrDie("aos/testdata/expected.json"), "\n"),
38 FlatbufferToJson(config, true));
39}
40
Austin Schuh217a9782019-12-21 23:02:50 -080041// Tests that we can read and merge a multinode configuration.
42TEST_F(ConfigurationTest, ConfigMergeMultinode) {
43 FlatbufferDetachedBuffer<Configuration> config =
44 ReadConfig("aos/testdata/config1_multinode.json");
45 LOG(INFO) << "Read: " << FlatbufferToJson(config, true);
46
47 EXPECT_EQ(
48 std::string(absl::StripSuffix(
49 util::ReadFileToStringOrDie("aos/testdata/expected_multinode.json"),
50 "\n")),
51 FlatbufferToJson(config, true));
52}
53
Alex Perrycb7da4b2019-08-28 19:35:56 -070054// Tests that we sort the entries in a config so we can look entries up.
55TEST_F(ConfigurationTest, UnsortedConfig) {
56 FlatbufferDetachedBuffer<Configuration> config =
57 ReadConfig("aos/testdata/backwards.json");
58
59 LOG(INFO) << "Read: " << FlatbufferToJson(config, true);
60
61 EXPECT_EQ(FlatbufferToJson(GetChannel(config, ".aos.robot_state",
Austin Schuhbca6cf02019-12-22 17:28:34 -080062 "aos.RobotState", "app1", nullptr)),
Alex Perrycb7da4b2019-08-28 19:35:56 -070063 "{ \"name\": \".aos.robot_state\", \"type\": \"aos.RobotState\", "
64 "\"max_size\": 5 }");
65}
66
Austin Schuhcb108412019-10-13 16:09:54 -070067// Tests that we die when a file is imported twice.
68TEST_F(ConfigurationDeathTest, DuplicateFile) {
69 EXPECT_DEATH(
70 {
Austin Schuh40485ed2019-10-26 21:51:44 -070071 FlatbufferDetachedBuffer<Configuration> config =
Austin Schuhcb108412019-10-13 16:09:54 -070072 ReadConfig("aos/testdata/config1_bad.json");
73 },
74 "aos/testdata/config1_bad.json");
75}
76
77// Tests that we can lookup a location, complete with maps, from a merged
78// config.
Austin Schuh40485ed2019-10-26 21:51:44 -070079TEST_F(ConfigurationTest, GetChannel) {
80 FlatbufferDetachedBuffer<Configuration> config =
81 ReadConfig("aos/testdata/config1.json");
Austin Schuhcb108412019-10-13 16:09:54 -070082
83 // Test a basic lookup first.
Austin Schuhbca6cf02019-12-22 17:28:34 -080084 EXPECT_EQ(
85 FlatbufferToJson(GetChannel(config, "/foo", ".aos.bar", "app1", nullptr)),
86 kExpectedLocation);
Austin Schuhcb108412019-10-13 16:09:54 -070087
88 // Test that an invalid name results in nullptr back.
Austin Schuhbca6cf02019-12-22 17:28:34 -080089 EXPECT_EQ(GetChannel(config, "/invalid_name", ".aos.bar", "app1", nullptr),
90 nullptr);
Austin Schuhcb108412019-10-13 16:09:54 -070091
92 // Tests that a root map/rename works. And that they get processed from the
93 // bottom up.
Austin Schuhbca6cf02019-12-22 17:28:34 -080094 EXPECT_EQ(FlatbufferToJson(
95 GetChannel(config, "/batman", ".aos.bar", "app1", nullptr)),
96 kExpectedLocation);
Austin Schuhcb108412019-10-13 16:09:54 -070097
98 // And then test that an application specific map/rename works.
Austin Schuhbca6cf02019-12-22 17:28:34 -080099 EXPECT_EQ(
100 FlatbufferToJson(GetChannel(config, "/bar", ".aos.bar", "app1", nullptr)),
101 kExpectedLocation);
102 EXPECT_EQ(
103 FlatbufferToJson(GetChannel(config, "/baz", ".aos.bar", "app2", nullptr)),
104 kExpectedLocation);
Austin Schuhcb108412019-10-13 16:09:54 -0700105
106 // And then test that an invalid application name gets properly ignored.
Austin Schuhbca6cf02019-12-22 17:28:34 -0800107 EXPECT_EQ(
108 FlatbufferToJson(GetChannel(config, "/foo", ".aos.bar", "app3", nullptr)),
109 kExpectedLocation);
110}
111
112// Tests that we can lookup a location with node specific maps.
113TEST_F(ConfigurationTest, GetChannelMultinode) {
114 FlatbufferDetachedBuffer<Configuration> config =
115 ReadConfig("aos/testdata/good_multinode.json");
116 const Node *pi1 = GetNode(&config.message(), "pi1");
117 const Node *pi2 = GetNode(&config.message(), "pi2");
118
119 // Test a basic lookup first.
120 EXPECT_EQ(
121 FlatbufferToJson(GetChannel(config, "/foo", ".aos.bar", "app1", pi1)),
122 kExpectedMultinodeLocation);
123 EXPECT_EQ(
124 FlatbufferToJson(GetChannel(config, "/foo", ".aos.bar", "app1", pi2)),
125 kExpectedMultinodeLocation);
126
127 // Tests that a root map/rename works with a node specific map.
128 EXPECT_EQ(FlatbufferToJson(
129 GetChannel(config, "/batman", ".aos.bar", "app1", pi1)),
130 kExpectedMultinodeLocation);
131
132 // Tests that a root map/rename fails with a node specific map for the wrong
133 // node.
134 EXPECT_EQ(GetChannel(config, "/batman", ".aos.bar", "app1", pi2), nullptr);
135
136 // And then test that an application specific map/rename works.
137 EXPECT_EQ(
138 FlatbufferToJson(GetChannel(config, "/batman2", ".aos.bar", "app1", pi1)),
139 kExpectedMultinodeLocation);
140 EXPECT_EQ(
141 FlatbufferToJson(GetChannel(config, "/batman3", ".aos.bar", "app1", pi1)),
142 kExpectedMultinodeLocation);
143
144 // And then that it fails when the node changes.
145 EXPECT_EQ(GetChannel(config, "/batman3", ".aos.bar", "app1", pi2), nullptr);
146}
147
148// Tests that we can lookup a location with type specific maps.
149TEST_F(ConfigurationTest, GetChannelTypedMultinode) {
150 FlatbufferDetachedBuffer<Configuration> config =
151 ReadConfig("aos/testdata/good_multinode.json");
152 const Node *pi1 = GetNode(&config.message(), "pi1");
153
154 // Test a basic lookup first.
155 EXPECT_EQ(
156 FlatbufferToJson(GetChannel(config, "/batman", ".aos.bar", "app1", pi1)),
157 kExpectedMultinodeLocation);
158
159 // Now confirm that a second message on the same name doesn't get remapped.
160 const char *kExpectedBazMultinodeLocation =
161 "{ \"name\": \"/batman\", \"type\": \".aos.baz\", \"max_size\": 5, "
162 "\"source_node\": \"pi1\" }";
163 EXPECT_EQ(
164 FlatbufferToJson(GetChannel(config, "/batman", ".aos.baz", "app1", pi1)),
165 kExpectedBazMultinodeLocation);
Austin Schuhcb108412019-10-13 16:09:54 -0700166}
167
Austin Schuh217a9782019-12-21 23:02:50 -0800168// Tests that we reject a configuration which has a nodes list, but has channels
169// withoout source_node filled out.
170TEST_F(ConfigurationDeathTest, InvalidSourceNode) {
171 EXPECT_DEATH(
172 {
173 FlatbufferDetachedBuffer<Configuration> config =
174 ReadConfig("aos/testdata/invalid_nodes.json");
175 },
176 "source_node");
177
178 EXPECT_DEATH(
179 {
180 FlatbufferDetachedBuffer<Configuration> config =
181 ReadConfig("aos/testdata/invalid_source_node.json");
182 },
183 "source_node");
184
185 EXPECT_DEATH(
186 {
187 FlatbufferDetachedBuffer<Configuration> config =
188 ReadConfig("aos/testdata/invalid_destination_node.json");
189 },
190 "destination_nodes");
191
192 EXPECT_DEATH(
193 {
194 FlatbufferDetachedBuffer<Configuration> config =
195 ReadConfig("aos/testdata/self_forward.json");
196 },
197 "forwarding data to itself");
198}
199
200// Tests that our node writeable helpers work as intended.
201TEST_F(ConfigurationTest, ChannelIsSendableOnNode) {
202 FlatbufferDetachedBuffer<Channel> good_channel(JsonToFlatbuffer(
Austin Schuh719946b2019-12-28 14:51:01 -0800203 R"channel({
Austin Schuh217a9782019-12-21 23:02:50 -0800204 "name": "/test",
205 "type": "aos.examples.Ping",
206 "source_node": "foo"
207})channel",
208 Channel::MiniReflectTypeTable()));
209
210 FlatbufferDetachedBuffer<Channel> bad_channel(JsonToFlatbuffer(
Austin Schuh719946b2019-12-28 14:51:01 -0800211 R"channel({
Austin Schuh217a9782019-12-21 23:02:50 -0800212 "name": "/test",
213 "type": "aos.examples.Ping",
214 "source_node": "bar"
215})channel",
216 Channel::MiniReflectTypeTable()));
217
218 FlatbufferDetachedBuffer<Node> node(JsonToFlatbuffer(
Austin Schuh719946b2019-12-28 14:51:01 -0800219 R"node({
Austin Schuh217a9782019-12-21 23:02:50 -0800220 "name": "foo"
221})node",
222 Node::MiniReflectTypeTable()));
223
224 EXPECT_TRUE(
225 ChannelIsSendableOnNode(&good_channel.message(), &node.message()));
226 EXPECT_FALSE(
227 ChannelIsSendableOnNode(&bad_channel.message(), &node.message()));
228}
229
230// Tests that our node readable and writeable helpers work as intended.
231TEST_F(ConfigurationTest, ChannelIsReadableOnNode) {
232 FlatbufferDetachedBuffer<Channel> good_channel(JsonToFlatbuffer(
Austin Schuh719946b2019-12-28 14:51:01 -0800233 R"channel({
Austin Schuh217a9782019-12-21 23:02:50 -0800234 "name": "/test",
235 "type": "aos.examples.Ping",
236 "source_node": "bar",
237 "destination_nodes": [
Austin Schuh719946b2019-12-28 14:51:01 -0800238 {
239 "name": "baz"
240 },
241 {
242 "name": "foo"
243 }
Austin Schuh217a9782019-12-21 23:02:50 -0800244 ]
245})channel",
246 Channel::MiniReflectTypeTable()));
247
248 FlatbufferDetachedBuffer<Channel> bad_channel1(JsonToFlatbuffer(
Austin Schuh719946b2019-12-28 14:51:01 -0800249 R"channel({
Austin Schuh217a9782019-12-21 23:02:50 -0800250 "name": "/test",
251 "type": "aos.examples.Ping",
252 "source_node": "bar"
253})channel",
254 Channel::MiniReflectTypeTable()));
255
256 FlatbufferDetachedBuffer<Channel> bad_channel2(JsonToFlatbuffer(
Austin Schuh719946b2019-12-28 14:51:01 -0800257 R"channel({
Austin Schuh217a9782019-12-21 23:02:50 -0800258 "name": "/test",
259 "type": "aos.examples.Ping",
260 "source_node": "bar",
261 "destination_nodes": [
Austin Schuh719946b2019-12-28 14:51:01 -0800262 {
263 "name": "baz"
264 }
Austin Schuh217a9782019-12-21 23:02:50 -0800265 ]
266})channel",
267 Channel::MiniReflectTypeTable()));
268
269 FlatbufferDetachedBuffer<Node> node(JsonToFlatbuffer(
Austin Schuh719946b2019-12-28 14:51:01 -0800270 R"node({
Austin Schuh217a9782019-12-21 23:02:50 -0800271 "name": "foo"
272})node",
273 Node::MiniReflectTypeTable()));
274
275 EXPECT_TRUE(
276 ChannelIsReadableOnNode(&good_channel.message(), &node.message()));
277 EXPECT_FALSE(
278 ChannelIsReadableOnNode(&bad_channel1.message(), &node.message()));
279 EXPECT_FALSE(
280 ChannelIsReadableOnNode(&bad_channel2.message(), &node.message()));
281}
282
Austin Schuh719946b2019-12-28 14:51:01 -0800283// Tests that our node message is logged helpers work as intended.
284TEST_F(ConfigurationTest, ChannelMessageIsLoggedOnNode) {
285 FlatbufferDetachedBuffer<Channel> logged_on_self_channel(JsonToFlatbuffer(
286 R"channel({
287 "name": "/test",
288 "type": "aos.examples.Ping",
289 "source_node": "bar",
290 "destination_nodes": [
291 {
292 "name": "baz"
293 }
294 ]
295})channel",
296 Channel::MiniReflectTypeTable()));
Austin Schuh217a9782019-12-21 23:02:50 -0800297
Austin Schuh719946b2019-12-28 14:51:01 -0800298 FlatbufferDetachedBuffer<Channel> not_logged_channel(JsonToFlatbuffer(
299 R"channel({
300 "name": "/test",
301 "type": "aos.examples.Ping",
302 "source_node": "bar",
303 "logger": "NOT_LOGGED",
304 "destination_nodes": [
305 {
306 "name": "baz",
307 "timestamp_logger": "LOCAL_LOGGER"
308 }
309 ]
310})channel",
311 Channel::MiniReflectTypeTable()));
312
313 FlatbufferDetachedBuffer<Channel> logged_on_remote_channel(JsonToFlatbuffer(
314 R"channel({
315 "name": "/test",
316 "type": "aos.examples.Ping",
317 "source_node": "bar",
318 "logger": "REMOTE_LOGGER",
319 "logger_node": "baz",
320 "destination_nodes": [
321 {
322 "name": "baz"
323 }
324 ]
325})channel",
326 Channel::MiniReflectTypeTable()));
327
328 FlatbufferDetachedBuffer<Channel> logged_on_separate_logger_node_channel(
329 JsonToFlatbuffer(
330 R"channel({
331 "name": "/test",
332 "type": "aos.examples.Ping",
333 "source_node": "bar",
334 "logger": "REMOTE_LOGGER",
335 "logger_node": "foo",
336 "destination_nodes": [
337 {
338 "name": "baz"
339 }
340 ]
341})channel",
342 Channel::MiniReflectTypeTable()));
343
344 FlatbufferDetachedBuffer<Channel> logged_on_both_channel (
345 JsonToFlatbuffer(
346 R"channel({
347 "name": "/test",
348 "type": "aos.examples.Ping",
349 "source_node": "bar",
350 "logger": "LOCAL_AND_REMOTE_LOGGER",
351 "logger_node": "baz",
352 "destination_nodes": [
353 {
354 "name": "baz"
355 }
356 ]
357})channel",
358 Channel::MiniReflectTypeTable()));
359
360 FlatbufferDetachedBuffer<Node> foo_node(JsonToFlatbuffer(
361 R"node({
362 "name": "foo"
363})node",
364 Node::MiniReflectTypeTable()));
365
366 FlatbufferDetachedBuffer<Node> bar_node(JsonToFlatbuffer(
367 R"node({
368 "name": "bar"
369})node",
370 Node::MiniReflectTypeTable()));
371
372 FlatbufferDetachedBuffer<Node> baz_node(JsonToFlatbuffer(
373 R"node({
374 "name": "baz"
375})node",
376 Node::MiniReflectTypeTable()));
377
378 // Local logger.
379 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&logged_on_self_channel.message(),
380 &foo_node.message()));
381 EXPECT_TRUE(ChannelMessageIsLoggedOnNode(&logged_on_self_channel.message(),
382 &bar_node.message()));
383 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&logged_on_self_channel.message(),
384 &baz_node.message()));
385
386 // No logger.
387 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&not_logged_channel.message(),
388 &foo_node.message()));
389 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&not_logged_channel.message(),
390 &bar_node.message()));
391 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&not_logged_channel.message(),
392 &baz_node.message()));
393
394 // Remote logger.
395 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&logged_on_remote_channel.message(),
396 &foo_node.message()));
397 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&logged_on_remote_channel.message(),
398 &bar_node.message()));
399 EXPECT_TRUE(ChannelMessageIsLoggedOnNode(&logged_on_remote_channel.message(),
400 &baz_node.message()));
401
402 // Separate logger.
403 EXPECT_TRUE(ChannelMessageIsLoggedOnNode(
404 &logged_on_separate_logger_node_channel.message(), &foo_node.message()));
405 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(
406 &logged_on_separate_logger_node_channel.message(), &bar_node.message()));
407 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(
408 &logged_on_separate_logger_node_channel.message(), &baz_node.message()));
409
410 // Logged in multiple places.
411 EXPECT_FALSE(ChannelMessageIsLoggedOnNode(&logged_on_both_channel.message(),
412 &foo_node.message()));
413 EXPECT_TRUE(ChannelMessageIsLoggedOnNode(&logged_on_both_channel.message(),
414 &bar_node.message()));
415 EXPECT_TRUE(ChannelMessageIsLoggedOnNode(&logged_on_both_channel.message(),
416 &baz_node.message()));
417}
418
419// Tests that our forwarding timestamps are logged helpers work as intended.
420TEST_F(ConfigurationTest, ConnectionDeliveryTimeIsLoggedOnNode) {
421 FlatbufferDetachedBuffer<Channel> logged_on_self_channel(JsonToFlatbuffer(
422 R"channel({
423 "name": "/test",
424 "type": "aos.examples.Ping",
425 "source_node": "bar",
426 "logger": "REMOTE_LOGGER",
427 "logger_node": "baz",
428 "destination_nodes": [
429 {
430 "name": "baz"
431 }
432 ]
433})channel",
434 Channel::MiniReflectTypeTable()));
435
436 FlatbufferDetachedBuffer<Channel> not_logged_channel(JsonToFlatbuffer(
437 R"channel({
438 "name": "/test",
439 "type": "aos.examples.Ping",
440 "source_node": "bar",
441 "logger": "NOT_LOGGED",
442 "destination_nodes": [
443 {
444 "name": "baz",
445 "timestamp_logger": "NOT_LOGGED"
446 }
447 ]
448})channel",
449 Channel::MiniReflectTypeTable()));
450
451 FlatbufferDetachedBuffer<Channel> logged_on_remote_channel(JsonToFlatbuffer(
452 R"channel({
453 "name": "/test",
454 "type": "aos.examples.Ping",
455 "source_node": "bar",
456 "destination_nodes": [
457 {
458 "name": "baz",
459 "timestamp_logger": "REMOTE_LOGGER",
460 "timestamp_logger_node": "bar"
461 }
462 ]
463})channel",
464 Channel::MiniReflectTypeTable()));
465
466 FlatbufferDetachedBuffer<Channel> logged_on_separate_logger_node_channel(
467 JsonToFlatbuffer(
468 R"channel({
469 "name": "/test",
470 "type": "aos.examples.Ping",
471 "source_node": "bar",
472 "logger": "REMOTE_LOGGER",
473 "logger_node": "foo",
474 "destination_nodes": [
475 {
476 "name": "baz",
477 "timestamp_logger": "REMOTE_LOGGER",
478 "timestamp_logger_node": "foo"
479 }
480 ]
481})channel",
482 Channel::MiniReflectTypeTable()));
483
484 FlatbufferDetachedBuffer<Channel> logged_on_both_channel (
485 JsonToFlatbuffer(
486 R"channel({
487 "name": "/test",
488 "type": "aos.examples.Ping",
489 "source_node": "bar",
490 "destination_nodes": [
491 {
492 "name": "baz",
493 "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
494 "timestamp_logger_node": "bar"
495 }
496 ]
497})channel",
498 Channel::MiniReflectTypeTable()));
499
500 FlatbufferDetachedBuffer<Node> foo_node(JsonToFlatbuffer(
501 R"node({
502 "name": "foo"
503})node",
504 Node::MiniReflectTypeTable()));
505
506 FlatbufferDetachedBuffer<Node> bar_node(JsonToFlatbuffer(
507 R"node({
508 "name": "bar"
509})node",
510 Node::MiniReflectTypeTable()));
511
512 FlatbufferDetachedBuffer<Node> baz_node(JsonToFlatbuffer(
513 R"node({
514 "name": "baz"
515})node",
516 Node::MiniReflectTypeTable()));
517
518 // Local logger.
519 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
520 &logged_on_self_channel.message(), &baz_node.message(),
521 &foo_node.message()));
522 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
523 &logged_on_self_channel.message(), &baz_node.message(),
524 &bar_node.message()));
525 EXPECT_TRUE(ConnectionDeliveryTimeIsLoggedOnNode(
526 &logged_on_self_channel.message(), &baz_node.message(),
527 &baz_node.message()));
528
529 // No logger means.
530 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
531 &not_logged_channel.message(), &baz_node.message(), &foo_node.message()));
532 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
533 &not_logged_channel.message(), &baz_node.message(), &bar_node.message()));
534 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
535 &not_logged_channel.message(), &baz_node.message(), &baz_node.message()));
536
537 // Remote logger.
538 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
539 &logged_on_remote_channel.message(), &baz_node.message(),
540 &foo_node.message()));
541 EXPECT_TRUE(ConnectionDeliveryTimeIsLoggedOnNode(
542 &logged_on_remote_channel.message(), &baz_node.message(),
543 &bar_node.message()));
544 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
545 &logged_on_remote_channel.message(), &baz_node.message(),
546 &baz_node.message()));
547
548 // Separate logger.
549 EXPECT_TRUE(ConnectionDeliveryTimeIsLoggedOnNode(
550 &logged_on_separate_logger_node_channel.message(), &baz_node.message(),
551 &foo_node.message()));
552 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
553 &logged_on_separate_logger_node_channel.message(), &baz_node.message(),
554 &bar_node.message()));
555 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
556 &logged_on_separate_logger_node_channel.message(), &baz_node.message(),
557 &baz_node.message()));
558
559 // Logged on both the node and a remote node.
560 EXPECT_FALSE(ConnectionDeliveryTimeIsLoggedOnNode(
561 &logged_on_both_channel.message(), &baz_node.message(),
562 &foo_node.message()));
563 EXPECT_TRUE(ConnectionDeliveryTimeIsLoggedOnNode(
564 &logged_on_both_channel.message(), &baz_node.message(),
565 &bar_node.message()));
566 EXPECT_TRUE(ConnectionDeliveryTimeIsLoggedOnNode(
567 &logged_on_both_channel.message(), &baz_node.message(),
568 &baz_node.message()));
569}
Austin Schuhcb108412019-10-13 16:09:54 -0700570} // namespace testing
571} // namespace configuration
572} // namespace aos