Reorganise the sidecars
[ric-app/mc.git] / sidecars / listener / TESTING
1 Quick test
2 Build the container, and run the test:
3         # the container version number may be different than illustrated here
4         bash build_images.sh
5         docker run -it --rm mc_listener:1.2.1 bash /playpen/bin/verify.sh -l
6
7
8
9 Indepth Testing Details
10 The verify.sh script can be used to verify that the mc_listener binary
11 in the container is working.  The script will create a sending process
12 that will send messages to the listener.  It will also create a pipe
13 reader process for each FIFO that is expected to be created by the 
14 listener.  
15
16 The default test
17         bash /playpen/bin/verify.sh
18
19 The default is a short, approximately 15 second, test which
20 will generate all of the FIFOs, and a single raw data capture file
21 in the staging directory.  The test isn't long enough for the raw
22 data capture mechanism to attempt to "roll" the capture file.
23
24 The long test
25         bash /playpen/bin/verify.sh -l
26
27 The long test runs for approximately 150 seconds and sets the roll
28 frequency on the capture files to 13 seconds.  This test should
29 generate several files in the "final" directory. One, in progress,
30 file should be left in the staging directory.
31
32 Copy vs Rename
33 By default the raw data capture will attempt to rename the file to
34 move it from staging to final. However, if these directories are not
35 on the same filesystem the rename will fail.  In this case, the rdc
36 code will copy the file.  These two mechanisms can be tested by
37 supplying the container with an external volume, /data, which contains
38 a final directory.  For example:
39
40         mkdir -p /tmp/rdc/final
41         docker run -v /tmp/rdc:/data --rm -it mc_listener:1.2.0 bash /playpen/bin/verify.sh -l
42
43 When the verify script sees /data/final it will set that as the directory
44 for the finished files rather than using the default which is on the
45 same filesystem as the staging directory.  The staging directory can
46 be changed to be an external directory by adding ./stage to the volume
47 which is mounted. For example
48
49         mkdir -p /tmp/rdc/stage
50
51 The verify script will find this and switch away from the default and
52 allow a test with both directories to originate from outside of the
53 container.
54
55
56 Sample output
57 The following is sample output from running the long test:
58
59
60 >> docker run -v /tmp/foo:/data --rm -it mc_listener:1.2.0 bash /playpen/bin/verify.sh -l
61 ### found /data/final using that as final directory
62 starting listener
63 starting pipe reader 0
64 starting pipe reader 1
65 starting pipe reader 2
66 starting pipe reader 3
67 starting pipe reader 4
68 starting pipe reader 5
69 starting pipe reader 6
70 starting sender
71 stopping listener
72 stopping sender
73 stopping pipe reader 0
74 stopping pipe reader 1
75 stopping pipe reader 3
76 stopping pipe reader 4
77 stopping pipe reader 5
78 stopping pipe reader 2
79 stopping pipe reader 6
80 all functions stopped; looking at logs
81 ----- logs ---------
82 -rw-r--r-- 1 root root  41337 Oct  8 16:24 /tmp/listen.log
83 -rw-r--r-- 1 root root      0 Oct  8 16:22 /tmp/pr.0.log
84 -rw-r--r-- 1 root root 176128 Oct  8 16:24 /tmp/pr.1.log
85 -rw-r--r-- 1 root root 176128 Oct  8 16:24 /tmp/pr.2.log
86 -rw-r--r-- 1 root root 176128 Oct  8 16:24 /tmp/pr.3.log
87 -rw-r--r-- 1 root root 176128 Oct  8 16:24 /tmp/pr.4.log
88 -rw-r--r-- 1 root root 176128 Oct  8 16:24 /tmp/pr.5.log
89 -rw-r--r-- 1 root root 176128 Oct  8 16:24 /tmp/pr.6.log
90 -rw-r--r-- 1 root root 195232 Oct  8 16:24 /tmp/sender.log
91 [OK]    All logs seem good
92 [OK]    Found expected fifos
93 [OK]    Found staging direcory (/tmp/rdc/stage)
94 total 100
95 drwxr-xr-x 2 root root  4096 Oct  8 16:24 .
96 drwxr-xr-x 3 root root  4096 Oct  8 16:22 ..
97 --w------- 1 root root 93628 Oct  8 16:24 MCLT_1570551840
98 [OK]    Found final direcory (/data/final)
99 total 1040
100 drwxrwxr-x 2 1001 1001   4096 Oct  8 16:24 .
101 drwxrwxr-x 3 1001 1001   4096 Oct  8 16:22 ..
102 -rw-rw-r-- 1 root root 146157 Oct  8 16:22 MCLT_1570551749.rdc
103 -rw-rw-r-- 1 root root 149222 Oct  8 16:22 MCLT_1570551762.rdc
104 -rw-rw-r-- 1 root root 149199 Oct  8 16:23 MCLT_1570551775.rdc
105 -rw-rw-r-- 1 root root 149200 Oct  8 16:23 MCLT_1570551788.rdc
106 -rw-rw-r-- 1 root root 149209 Oct  8 16:23 MCLT_1570551801.rdc
107 -rw-rw-r-- 1 root root 149191 Oct  8 16:23 MCLT_1570551814.rdc
108 -rw-rw-r-- 1 root root 149206 Oct  8 16:24 MCLT_1570551827.rdc
109 [OK]   Found 7 files in final directory (/data/final)
110 [PASS]
111