File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
tests/conformance-tests/src Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,22 @@ pub fn run_test(
15
15
conformance_tests:: config:: Precondition :: TcpEcho => {
16
16
services. push ( "tcp-echo" ) ;
17
17
}
18
- conformance_tests:: config:: Precondition :: Redis => services. push ( "redis" ) ,
19
- conformance_tests:: config:: Precondition :: Mqtt => services. push ( "mqtt" ) ,
18
+ conformance_tests:: config:: Precondition :: Redis => {
19
+ if is_docker_installed ( ) {
20
+ services. push ( "redis" )
21
+ } else {
22
+ // Skip the test if docker is not installed.
23
+ return Ok ( ( ) ) ;
24
+ }
25
+ }
26
+ conformance_tests:: config:: Precondition :: Mqtt => {
27
+ if is_docker_installed ( ) {
28
+ services. push ( "mqtt" )
29
+ } else {
30
+ // Skip the test if docker is not installed.
31
+ return Ok ( ( ) ) ;
32
+ }
33
+ }
20
34
conformance_tests:: config:: Precondition :: KeyValueStore ( _) => { }
21
35
conformance_tests:: config:: Precondition :: Sqlite => { }
22
36
}
@@ -57,3 +71,12 @@ pub fn run_test(
57
71
}
58
72
Ok ( ( ) )
59
73
}
74
+
75
+ /// Whether or not docker is installed on the system.
76
+ fn is_docker_installed ( ) -> bool {
77
+ std:: process:: Command :: new ( "docker" )
78
+ . arg ( "--version" )
79
+ . output ( )
80
+ . map ( |output| output. status . success ( ) )
81
+ . unwrap_or ( false )
82
+ }
You can’t perform that action at this time.
0 commit comments