]> git.meshlink.io Git - meshlink/blob - test/blackbox/run_blackbox_tests/test_cases_channel_conn.c
Ensure NDEBUG is not set in the test suite.
[meshlink] / test / blackbox / run_blackbox_tests / test_cases_channel_conn.c
1 /*
2     test_cases_channel_conn.c -- Execution of specific meshlink black box test cases
3     Copyright (C) 2018  Guus Sliepen <guus@meshlink.io>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License along
16     with this program; if not, write to the Free Software Foundation, Inc.,
17     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifdef NDEBUG
21 #undef NDEBUG
22 #endif
23
24 #include <assert.h>
25 #include <string.h>
26 #include <stdlib.h>
27 #include <stdarg.h>
28 #include <setjmp.h>
29 #include <pthread.h>
30 #include <cmocka.h>
31 #include "execute_tests.h"
32 #include "test_cases_channel_conn.h"
33 #include "../common/containers.h"
34 #include "../common/test_step.h"
35 #include "../common/common_handlers.h"
36 #include "../common/mesh_event_handler.h"
37
38 #define PEER_ID "0"
39 #define NUT_ID  "1"
40 #define RELAY_ID  "2"
41
42 static void test_case_channel_conn_01(void **state);
43 static bool test_steps_channel_conn_01(void);
44 static void test_case_channel_conn_02(void **state);
45 static bool test_steps_channel_conn_02(void);
46 static void test_case_channel_conn_03(void **state);
47 static bool test_steps_channel_conn_03(void);
48 static void test_case_channel_conn_04(void **state);
49 static bool test_steps_channel_conn_04(void);
50 static void test_case_channel_conn_05(void **state);
51 static bool test_steps_channel_conn_05(void);
52 static void test_case_channel_conn_06(void **state);
53 static bool test_steps_channel_conn_06(void);
54 static void test_case_channel_conn_07(void **state);
55 static bool test_steps_channel_conn_07(void);
56 static void test_case_channel_conn_08(void **state);
57 static bool test_steps_channel_conn_08(void);
58
59 static char *test_channel_conn_2_nodes[] = { "peer", "nut" };
60 static char *test_channel_conn_3_nodes[] = { "peer", "nut", "relay" };
61
62 static black_box_state_t test_case_channel_conn_01_state = {
63         .test_case_name = "test_case_channel_conn_01",
64         .node_names = test_channel_conn_2_nodes,
65         .num_nodes = 2,
66 };
67 static black_box_state_t test_case_channel_conn_02_state = {
68         .test_case_name = "test_case_channel_conn_02",
69         .node_names = test_channel_conn_2_nodes,
70         .num_nodes = 2,
71 };
72 static black_box_state_t test_case_channel_conn_03_state = {
73         .test_case_name = "test_case_channel_conn_03",
74         .node_names = test_channel_conn_2_nodes,
75         .num_nodes = 2,
76 };
77 static black_box_state_t test_case_channel_conn_04_state = {
78         .test_case_name = "test_case_channel_conn_04",
79         .node_names = test_channel_conn_2_nodes,
80         .num_nodes = 2,
81 };
82 static black_box_state_t test_case_channel_conn_05_state = {
83         .test_case_name = "test_case_channel_conn_05",
84         .node_names = test_channel_conn_3_nodes,
85         .num_nodes = 3,
86 };
87 static black_box_state_t test_case_channel_conn_06_state = {
88         .test_case_name = "test_case_channel_conn_06",
89         .node_names = test_channel_conn_3_nodes,
90         .num_nodes = 3,
91 };
92 static black_box_state_t test_case_channel_conn_07_state = {
93         .test_case_name = "test_case_channel_conn_07",
94         .node_names = test_channel_conn_3_nodes,
95         .num_nodes = 3,
96 };
97 static black_box_state_t test_case_channel_conn_08_state = {
98         .test_case_name = "test_case_channel_conn_08",
99         .node_names = test_channel_conn_3_nodes,
100         .num_nodes = 3,
101 };
102
103 static bool joined;
104 static bool channel_opened;
105 static bool node_restarted;
106 static bool received_error;
107 static bool channel_received;
108 static bool node_reachable;
109 static bool node_unreachable;
110
111 /* Callback function for handling channel connection test cases mesh events */
112 static bool channel_conn_cb(mesh_event_payload_t payload) {
113         switch(payload.mesh_event) {
114         case NODE_JOINED            :
115                 joined = true;
116                 break;
117
118         case CHANNEL_OPENED         :
119                 channel_opened = true;
120                 break;
121
122         case NODE_RESTARTED         :
123                 node_restarted = true;
124                 break;
125
126         case ERR_NETWORK            :
127                 received_error = true;
128                 break;
129
130         case CHANNEL_DATA_RECIEVED  :
131                 channel_received = true;
132                 break;
133
134         case NODE_UNREACHABLE       :
135                 node_unreachable = true;
136                 break;
137
138         case NODE_REACHABLE         :
139                 node_reachable = true;
140                 break;
141
142         default                     :
143                 PRINT_TEST_CASE_MSG("Undefined event occurred\n");
144         }
145
146         return true;
147 }
148
149 /* Execute channel connections Test Case # 1 - simulate a temporary network
150     failure of about 30 seconds, messages sent while the network was down
151     should be received by the other side after the network comes up again. */
152 static void test_case_channel_conn_01(void **state) {
153         execute_test(test_steps_channel_conn_01, state);
154         return;
155 }
156
157 /* Test Steps for channel connections Test Case # 1
158
159     Test Steps:
160     1. Run NUT & peer node instances and open a channel between them
161     2. Simulate a network failure in NUT's container for about 30 secs,
162         meanwhile send data via channel from NUT to peer.
163     3. After restoring network, peer node receive's data via channel.
164
165     Expected Result:
166     Peer node receives data via channel without any error after restoring network.
167 */
168 static bool test_steps_channel_conn_01(void) {
169         char *invite_nut;
170         char *import;
171
172         joined = false;
173         channel_opened = false;
174         channel_received = false;
175
176         // Setup Containers
177
178         install_in_container("nut", "iptables");
179         accept_port_rule("nut", "OUTPUT", "udp", 9000);
180         import = mesh_event_sock_create(eth_if_name);
181         invite_nut = invite_in_container("peer", "nut");
182         assert(invite_nut);
183
184         // Run node instances in containers & open a channel
185
186         node_sim_in_container_event("peer", "1", NULL, PEER_ID, import);
187         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
188
189         wait_for_event(channel_conn_cb, 30);
190         assert_int_equal(joined, true);
191
192         wait_for_event(channel_conn_cb, 30);
193         assert_int_equal(channel_opened, true);
194
195         // Simulate network failure in NUT's LXC container with it's IP address as NAT rule
196
197         block_node_ip("nut");
198         sleep(2);
199
200         // Sending SIGUSR1 signal to node-under-test indicating the network failure
201
202         node_step_in_container("nut", "SIGUSR1");
203         sleep(30);
204
205         // Restore NUT's network
206
207         unblock_node_ip("nut");
208
209         // Wait for peer node to receive data via channel from NUT
210
211         wait_for_event(channel_conn_cb, 60);
212
213         mesh_event_destroy();
214         free(invite_nut);
215         free(import);
216
217         assert_int_equal(channel_received, true);
218
219         return true;
220 }
221
222 /* Execute channel connections Test Case # 2 - a simulated network failure
223     of more than 1 minute, and sending messages over the channel during the
224     failure. Then after about 1 minute, the channel should receive an error */
225 static void test_case_channel_conn_02(void **state) {
226         execute_test(test_steps_channel_conn_02, state);
227         return;
228 }
229
230 /* Test Steps for channel connections Test Case # 2
231
232     Test Steps:
233     1. Run NUT and peer node instances in containers and open a channel between them.
234     2. Create a network failure for about 90 secs in NUT container
235         and signal NUT node about the network failure.
236     3. Meanwhile NUT sends data to peer via channel and restore the network after
237         90 secs.
238
239     Expected Result:
240       Peer node should receive error closing the channel after channel timeout(60 secs).
241 */
242 static bool test_steps_channel_conn_02(void) {
243         char *invite_nut;
244         char *import;
245
246         joined = false;
247         channel_opened = false;
248         received_error = false;
249
250         // Setup containers
251
252         install_in_container("nut", "iptables");
253         accept_port_rule("nut", "OUTPUT", "udp", 9000);
254         import = mesh_event_sock_create(eth_if_name);
255         invite_nut = invite_in_container("peer", "nut");
256         assert(invite_nut);
257
258         // Run NUT and peer node instances in containers & open a channel
259
260         node_sim_in_container_event("peer", "1", NULL, PEER_ID, import);
261         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
262
263         wait_for_event(channel_conn_cb, 30);
264         assert_int_equal(joined, true);
265
266         wait_for_event(channel_conn_cb, 10);
267         assert_int_equal(channel_opened, true);
268
269         // Simulate network failure in NUT's LXC container with it's IP address as NAT rule
270
271         block_node_ip("nut");
272
273         // Sending SIGUSR1 signal to node-under-test indicating the network failure
274
275         node_step_in_container("nut", "SIGUSR1");
276         sleep(90);
277
278         // Restore NUT containers network after 90 secs
279
280         unblock_node_ip("nut");
281
282         // Wait for peer node to send the event about the channel error occurred with length = 0
283
284         wait_for_event(channel_conn_cb, 90);
285
286         mesh_event_destroy();
287         free(invite_nut);
288         free(import);
289
290         assert_int_equal(received_error, true);
291
292         return true;
293 }
294
295 /* Execute channel connections Test Case # 3 - a simulated network failure
296     once node instance is made offline restore the network and send data via
297     channel  */
298 static void test_case_channel_conn_03(void **state) {
299         execute_test(test_steps_channel_conn_03, state);
300         return;
301 }
302
303 /* Test Steps for channel connections Test Case # 3
304
305     Test Steps:
306     1. Run NUT and peer node instances and open a channel between them.
307     2. Create a network failure in NUT container, bring NUT node offline
308         and receive the status at test driver and restore the network
309     3. After peer node instance is reachable to NUT node send data via channel
310
311     Expected Result:
312     Peer node should receive data from NUT without any error.
313 */
314 static bool test_steps_channel_conn_03(void) {
315         char *invite_nut;
316         char *import;
317
318         joined = false;
319         channel_opened = false;
320         node_unreachable = false;
321         node_reachable = false;
322         channel_received = false;
323
324         // Setup containers
325
326         install_in_container("nut", "iptables");
327         accept_port_rule("nut", "OUTPUT", "udp", 9000);
328         import = mesh_event_sock_create(eth_if_name);
329         invite_nut = invite_in_container("peer", "nut");
330         assert(invite_nut);
331
332         // Run NUT and peer node instances in containers & open a channel
333
334         node_sim_in_container_event("peer", "1", NULL, PEER_ID, import);
335         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
336
337         wait_for_event(channel_conn_cb, 30);
338         assert_int_equal(joined, true);
339
340         wait_for_event(channel_conn_cb, 10);
341         assert_int_equal(channel_opened, true);
342
343         // Simulate network failure in NUT's LXC container with it's IP address as NAT rule
344
345         node_reachable = false;
346         block_node_ip("nut");
347
348         // Sending SIGUSR1 signal to node-under-test indicating the network failure
349
350         node_step_in_container("nut", "SIGUSR1");
351
352         // Wait for the node status to become unreachable
353
354         wait_for_event(channel_conn_cb, 100);
355         assert_int_equal(node_unreachable, true);
356
357         // Restore NUT container's network
358
359         unblock_node_ip("nut");
360
361         // Wait for the node status to become reachable
362
363         wait_for_event(channel_conn_cb, 100);
364         assert_int_equal(node_reachable, true);
365
366         // Wait for data to be received at peer via channel from NUT after restoring n/w
367
368         wait_for_event(channel_conn_cb, 90);
369
370         mesh_event_destroy();
371         free(invite_nut);
372         free(import);
373
374         assert_int_equal(channel_received, true);
375
376         return true;
377 }
378
379 /* Execute channel connections Test Case # 4 - receiving an error when node-under-test
380     tries to send data on channel to peer node after peer node stops and starts the
381     node instance */
382 static void test_case_channel_conn_04(void **state) {
383         execute_test(test_steps_channel_conn_04, state);
384         return;
385 }
386
387 /* Test Steps for Meta-connections Test Case # 4
388
389     Test Steps:
390     1. Run peer and NUT node instances in containers and open a channel between them.
391     2. Stop and start the NUT node instance and wait for about > 60 secs.
392     3. Send data via channel from Peer node and wait for event in test driver.
393
394     Expected Result:
395     Peer node should receive error(as length = 0) in receive callback of peer node's instance.
396 */
397 static bool test_steps_channel_conn_04(void) {
398         char *invite_nut;
399         char *import;
400
401         joined = false;
402         channel_opened = false;
403         node_restarted = false;
404         received_error = false;
405         import = mesh_event_sock_create(eth_if_name);
406         invite_nut = invite_in_container("peer", "nut");
407         assert(invite_nut);
408
409         // Run NUT and peer node instances in containers and open a channel
410
411         node_sim_in_container_event("peer", "1", NULL, PEER_ID, import);
412         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
413
414         wait_for_event(channel_conn_cb, 10);
415         assert_int_equal(joined, true);
416
417         wait_for_event(channel_conn_cb, 10);
418         assert_int_equal(channel_opened, true);
419
420         // Wait for NUT node instance to stop and start
421
422         wait_for_event(channel_conn_cb, 60);
423         assert_int_equal(node_restarted, true);
424
425         sleep(60);
426
427         // After 1 min the channel between NUT and peer should result in error
428
429         wait_for_event(channel_conn_cb, 10);
430
431
432         mesh_event_destroy();
433         free(invite_nut);
434         free(import);
435
436         assert_int_equal(received_error, true);
437
438         return true;
439 }
440
441 /* Execute channel connections Test Case # 5 - simulate a temporary network
442     failure of about 30 seconds, messages sent while the network was down
443     should be received by the other side after the network comes up again. */
444 static void test_case_channel_conn_05(void **state) {
445         execute_test(test_steps_channel_conn_05, state);
446         return;
447 }
448
449 /* Test Steps for channel connections Test Case # 5
450
451     Test Steps:
452     1. Run NUT, relay & peer node instances with relay inviting NUT and peer
453         and open a channel between them
454     2. Simulate a network failure in NUT's container for about 30 secs,
455         meanwhile send data via channel from NUT to peer.
456     3. After restoring network, peer node receive's data via channel.
457
458     Expected Result:
459     Peer node receives data via channel without any error after restoring network.
460 */
461 static bool test_steps_channel_conn_05(void) {
462         char *invite_nut, *invite_peer;
463         char *import;
464
465         joined = false;
466         channel_opened = false;
467         channel_received = false;
468
469         // Setup containers
470
471         install_in_container("nut", "iptables");
472         accept_port_rule("nut", "OUTPUT", "udp", 9000);
473         import = mesh_event_sock_create(eth_if_name);
474         invite_peer = invite_in_container("relay", "peer");
475         invite_nut = invite_in_container("relay", "nut");
476         assert(invite_nut);
477         assert(invite_peer);
478
479         // Run node instances and open a channel between NUT and peer nodes
480
481         node_sim_in_container_event("relay", "1", NULL, RELAY_ID, import);
482         node_sim_in_container_event("peer", "1", invite_peer, PEER_ID, import);
483         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
484
485         wait_for_event(channel_conn_cb, 30);
486         assert_int_equal(joined, true);
487
488         wait_for_event(channel_conn_cb, 30);
489         assert_int_equal(channel_opened, true);
490
491         // Create a network failure in NUT node's container with it's IP address
492
493         block_node_ip("nut");
494
495         // Sending SIGUSR1 signal to node-under-test indicating the network failure
496
497         node_step_in_container("nut", "SIGUSR1");
498         sleep(30);
499
500         // Restore the network
501
502         unblock_node_ip("nut");
503
504         // Wait for peer to get data from NUT node via channel after restoring network in < 60 secs
505
506         wait_for_event(channel_conn_cb, 60);
507
508         mesh_event_destroy();
509         free(invite_peer);
510         free(invite_nut);
511         free(import);
512
513         assert_int_equal(channel_received, true);
514
515         return true;
516 }
517
518 /* Execute channel connections Test Case # 6 - a simulated network failure
519     of more than 1 minute, and sending messages over the channel during the
520     failure. Then after about 1 minute, the channel should receive an error */
521 static void test_case_channel_conn_06(void **state) {
522         execute_test(test_steps_channel_conn_06, state);
523         return;
524 }
525
526 /* Test Steps for channel connections Test Case # 6
527
528     Test Steps:
529     1. Run NUT, relay & peer node instances with relay inviting NUT and peer
530         and open a channel between them
531     2. Create a network failure for about 90 secs in NUT container
532         and signal NUT node about the network failure.
533     3. Meanwhile NUT sends data to peer via channel and restore the network after
534         90 secs.
535
536     Expected Result:
537       Peer node should receive error closing the channel after channel timeout(60 secs).
538 */
539 static bool test_steps_channel_conn_06(void) {
540         char *invite_nut, *invite_peer;
541         char *import;
542
543         joined = false;
544         channel_opened = false;
545         received_error = false;
546
547         // Setup containers
548
549         install_in_container("nut", "iptables");
550         accept_port_rule("nut", "OUTPUT", "udp", 9000);
551         import = mesh_event_sock_create(eth_if_name);
552         invite_peer = invite_in_container("relay", "peer");
553         assert(invite_peer);
554         invite_nut = invite_in_container("relay", "nut");
555         assert(invite_nut);
556
557         // Run nodes in containers and open a channel between NUt and peer
558
559         node_sim_in_container_event("relay", "1", NULL, RELAY_ID, import);
560         node_sim_in_container_event("peer", "1", invite_peer, PEER_ID, import);
561         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
562
563         wait_for_event(channel_conn_cb, 30);
564         assert_int_equal(joined, true);
565
566         wait_for_event(channel_conn_cb, 10);
567         assert_int_equal(channel_opened, true);
568
569         // Simulate a network failure in NUT's container for > 60 secs
570
571         block_node_ip("nut");
572
573         // Sending SIGUSR1 signal to node-under-test indicating the network failure
574
575         node_step_in_container("nut", "SIGUSR1");
576         sleep(90);
577
578         // Restore the network after 90 secs
579
580         unblock_node_ip("nut");
581
582         // Wait for channel to receive error and receive the event
583
584         wait_for_event(channel_conn_cb, 90);
585
586         mesh_event_destroy();
587         free(invite_peer);
588         free(invite_nut);
589         free(import);
590
591         assert_int_equal(received_error, true);
592
593         return true;
594 }
595
596 /* Execute channel connections Test Case # 7 - a simulated network failure
597     once node instance is made offline restore the network and send data via
598     channel  */
599 static void test_case_channel_conn_07(void **state) {
600         execute_test(test_steps_channel_conn_07, state);
601         return;
602 }
603
604 /* Test Steps for channel connections Test Case # 7
605
606     Test Steps:
607     1. Run NUT, relay & peer node instances with relay inviting NUT and peer
608         and open a channel between them
609     2. Create a network failure in NUT container, bring NUT node offline
610         and receive the status at test driver and restore the network
611     3. After peer node instance is reachable to NUT node send data via channel
612
613     Expected Result:
614     Peer node should receive data from NUT without any error.
615 */
616 static bool test_steps_channel_conn_07(void) {
617         char *invite_nut, *invite_peer;
618         char *import;
619
620         joined = false;
621         channel_opened = false;
622         node_unreachable = false;
623         node_reachable = false;
624         channel_received = false;
625
626         // Setup containers
627
628         install_in_container("nut", "iptables");
629         accept_port_rule("nut", "OUTPUT", "udp", 9000);
630         import = mesh_event_sock_create(eth_if_name);
631         invite_peer = invite_in_container("relay", "peer");
632         invite_nut = invite_in_container("relay", "nut");
633         assert(invite_nut);
634         assert(invite_peer);
635
636         // Run nodes and open a channel
637
638         node_sim_in_container_event("relay", "1", NULL, RELAY_ID, import);
639         node_sim_in_container_event("peer", "1", invite_peer, PEER_ID, import);
640         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
641
642         wait_for_event(channel_conn_cb, 30);
643         assert_int_equal(joined, true);
644
645         wait_for_event(channel_conn_cb, 15);
646         assert_int_equal(channel_opened, true);
647
648         // Simulate a network failure
649
650         node_reachable = false;
651         block_node_ip("nut");
652
653         // Sending SIGUSR1 signal to node-under-test indicating the network failure
654
655         node_step_in_container("nut", "SIGUSR1");
656
657         // Wait for node to become unreachable
658
659         wait_for_event(channel_conn_cb, 100);
660         assert_int_equal(node_unreachable, true);
661
662         // Restore the network
663
664         unblock_node_ip("nut");
665
666         // Wait for node to become reachable after restoring n/w
667
668         wait_for_event(channel_conn_cb, 100);
669         assert_int_equal(node_reachable, true);
670
671         // Wait for peer node to receive data via channel without any error
672
673         wait_for_event(channel_conn_cb, 90);
674
675         mesh_event_destroy();
676         free(invite_peer);
677         free(invite_nut);
678         free(import);
679
680         assert_int_equal(channel_received, true);
681
682         return true;
683 }
684
685 /* Execute channel connections Test Case # 8 - receiving an error when node-under-test
686     tries to send data on channel to peer node after peer node stops and starts the
687     node instance */
688 static void test_case_channel_conn_08(void **state) {
689         execute_test(test_steps_channel_conn_08, state);
690         return;
691 }
692
693 /* Test Steps for Meta-connections Test Case # 8
694
695     Test Steps:
696     1. Run NUT, relay & peer node instances with relay inviting NUT and peer
697         and open a channel between them
698     2. Stop and start the NUT node instance and wait for about > 60 secs.
699     3. Send data via channel from Peer node and wait for event in test driver.
700
701     Expected Result:
702     Peer node should receive error(as length = 0) in receive callback of peer node's instance.
703 */
704 static bool test_steps_channel_conn_08(void) {
705         char *invite_nut, *invite_peer;
706         char *import;
707
708         joined = false;
709         channel_opened = false;
710         node_restarted = false;
711         received_error = false;
712
713         // Setup containers
714
715         import = mesh_event_sock_create(eth_if_name);
716         invite_peer = invite_in_container("relay", "peer");
717         invite_nut = invite_in_container("relay", "nut");
718         assert(invite_nut);
719         assert(invite_peer);
720
721         // Run nodes and open a channel between NUT and peer
722
723         node_sim_in_container_event("relay", "1", NULL, RELAY_ID, import);
724         node_sim_in_container_event("peer", "1", invite_peer, PEER_ID, import);
725         node_sim_in_container_event("nut", "1", invite_nut, NUT_ID, import);
726
727         wait_for_event(channel_conn_cb, 10);
728         assert_int_equal(joined, true);
729
730         wait_for_event(channel_conn_cb, 10);
731         assert_int_equal(channel_opened, true);
732
733         // Wait for NUT node to restart it's instance
734
735         wait_for_event(channel_conn_cb, 60);
736         assert_int_equal(node_restarted, true);
737
738         sleep(60);
739
740         // Signal peer to send data to NUT node via channel
741
742         node_step_in_container("peer", "SIGUSR1");
743
744         // Wait for peer to receive channel error
745
746         wait_for_event(channel_conn_cb, 10);
747
748         mesh_event_destroy();
749         free(invite_peer);
750         free(invite_nut);
751         free(import);
752
753         assert_int_equal(received_error, true);
754
755         return true;
756 }
757
758 static int black_box_group_setup(void **state) {
759         (void)state;
760
761         const char *nodes[] = { "peer", "nut", "relay" };
762         int num_nodes = sizeof(nodes) / sizeof(nodes[0]);
763
764         printf("Creating Containers\n");
765         destroy_containers();
766         create_containers(nodes, num_nodes);
767
768         return 0;
769 }
770
771 static int black_box_group_teardown(void **state) {
772         (void)state;
773
774         printf("Destroying Containers\n");
775         destroy_containers();
776
777         return 0;
778 }
779
780 int test_meshlink_channel_conn(void) {
781         const struct CMUnitTest blackbox_group0_tests[] = {
782                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_01, setup_test, teardown_test,
783                                 (void *)&test_case_channel_conn_01_state),
784                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_02, setup_test, teardown_test,
785                                 (void *)&test_case_channel_conn_02_state),
786                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_03, setup_test, teardown_test,
787                                 (void *)&test_case_channel_conn_03_state),
788                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_04, setup_test, teardown_test,
789                                 (void *)&test_case_channel_conn_04_state),
790                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_05, setup_test, teardown_test,
791                                 (void *)&test_case_channel_conn_05_state),
792                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_06, setup_test, teardown_test,
793                                 (void *)&test_case_channel_conn_06_state),
794                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_07, setup_test, teardown_test,
795                                 (void *)&test_case_channel_conn_07_state),
796                 cmocka_unit_test_prestate_setup_teardown(test_case_channel_conn_08, setup_test, teardown_test,
797                                 (void *)&test_case_channel_conn_08_state),
798         };
799         total_tests += sizeof(blackbox_group0_tests) / sizeof(blackbox_group0_tests[0]);
800
801         return cmocka_run_group_tests(blackbox_group0_tests, black_box_group_setup, black_box_group_teardown);
802 }