File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,33 @@ teardown() {
13
13
| xargs -r docker rm -f;
14
14
}
15
15
16
- @test " plugin sends logs" {
16
+ @test " plugin send logs" {
17
+ run docker run \
18
+ --log-driver ' h1cr.io/h1-docker-logging-plugin:latest' \
19
+ --label dockerbats=" $BATS_TEST_NAME " \
20
+ --log-opt journal-id=${JOURNAL_ID} \
21
+ --log-opt journal-token=${JOURNAL_TOKEN} \
22
+ alpine sh -c ' echo $RANDOM' ;
23
+ [ " $status " -eq 0 ];
24
+ containerId=$( docker container ls -a -q --filter label=dockerbats=" $BATS_TEST_NAME " ) ;
25
+ run docker logs " ${containerId} " ;
26
+ echo " Output of logs: ${output} " ;
27
+ [ " $status " -eq 0 ]
28
+ }
29
+
30
+ @test " plugin flush logs" {
17
31
run docker run -d \
18
32
--log-driver ' h1cr.io/h1-docker-logging-plugin:latest' \
19
33
--label dockerbats=" $BATS_TEST_NAME " \
20
34
--log-opt journal-id=${JOURNAL_ID} \
21
35
--log-opt journal-token=${JOURNAL_TOKEN} \
22
- alpine sh -c ' echo $RANDOM ; sleep 30' ;
36
+ alpine sh -c ' seq 1 10 ; sleep 30' ;
23
37
[ " $status " -eq 0 ];
24
- # Wait for flush
38
+ # Wait for flush (15 second default)
25
39
sleep 20;
26
- run docker logs " ${output} " ;
40
+ containerId=$( docker container ls -a -q --filter label=dockerbats=" $BATS_TEST_NAME " ) ;
41
+ run docker logs " ${containerId} " ;
42
+ echo " Output of logs: ${output} " ;
27
43
[ " $status " -eq 0 ]
28
44
}
29
45
You can’t perform that action at this time.
0 commit comments