File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 15
15
16
16
context 'with defaults for all parameters' do
17
17
it { is_expected . to compile . with_all_deps }
18
- it { is_expected . to contain_exec ( 'plugin install foo/plugin:latest' ) . with_command ( %r{docker plugin install} ) }
18
+ it { is_expected . to contain_exec ( 'plugin install foo/plugin:latest' ) . with_command ( %r{docker plugin install} ) . with_unless ( %r{docker ls --format='{{.PluginReference}}' | grep -w foo/plugin:latest} ) }
19
19
end
20
20
21
21
context 'with enabled => false' do
22
22
let ( :params ) { { 'enabled' => false } }
23
23
24
24
it { is_expected . to compile . with_all_deps }
25
- it { is_expected . to contain_exec ( 'disable foo/plugin:latest' ) . with_command ( %r{docker plugin disable} ) }
25
+ it { is_expected . to contain_exec ( 'disable foo/plugin:latest' ) . with_command ( %r{docker plugin disable} ) . with_unless ( %r{docker ls --format='{{.PluginReference}}' | grep -w foo/plugin:latest} ) }
26
26
end
27
27
28
28
context 'with ensure => absent' do
29
29
let ( :params ) { { 'ensure' => 'absent' } }
30
30
31
31
it { is_expected . to compile . with_all_deps }
32
- it { is_expected . to contain_exec ( 'plugin remove foo/plugin:latest' ) . with_command ( %r{docker plugin rm} ) }
32
+ it { is_expected . to contain_exec ( 'plugin remove foo/plugin:latest' ) . with_command ( %r{docker plugin rm} ) . with_onlyif ( %r{docker ls --format='{{.PluginReference}}' | grep -w foo/plugin:latest} ) }
33
33
end
34
+
35
+ context 'with alias => foo-plugin' do
36
+ let ( :params ) { { 'plugin_alias' => 'foo-plugin' } }
37
+
38
+ it { is_expected . to contain_exec ( 'plugin install foo/plugin:latest' ) . with_command ( %r{docker plugin install} ) . with_unless ( %r{docker ls --format='{{.PluginReference}}' | grep -w foo/plugin:latest} ) }
39
+ end
40
+
34
41
end
You can’t perform that action at this time.
0 commit comments