kanrisuru 0.16.1 → 0.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/lib/kanrisuru/command.rb +2 -3
  4. data/lib/kanrisuru/core/zypper/commands/add_repo.rb +1 -8
  5. data/lib/kanrisuru/core/zypper/commands/add_service.rb +4 -2
  6. data/lib/kanrisuru/core/zypper/commands/info.rb +1 -2
  7. data/lib/kanrisuru/core/zypper/commands/install.rb +2 -3
  8. data/lib/kanrisuru/core/zypper/commands/modify_repo.rb +1 -7
  9. data/lib/kanrisuru/core/zypper/commands/modify_service.rb +3 -1
  10. data/lib/kanrisuru/core/zypper/commands/remove.rb +1 -2
  11. data/lib/kanrisuru/core/zypper/commands/remove_repo.rb +3 -3
  12. data/lib/kanrisuru/core/zypper/commands/remove_service.rb +6 -1
  13. data/lib/kanrisuru/core/zypper/commands/search.rb +1 -3
  14. data/lib/kanrisuru/core/zypper/commands/source_install.rb +2 -0
  15. data/lib/kanrisuru/core/zypper/commands.rb +10 -1
  16. data/lib/kanrisuru/remote/host.rb +1 -3
  17. data/lib/kanrisuru/version.rb +1 -1
  18. data/spec/functional/core/{ip/ip_address_label_spec.rb → ip_address_label_spec.rb} +0 -0
  19. data/spec/functional/core/{ip/ip_address_spec.rb → ip_address_spec.rb} +0 -0
  20. data/spec/functional/core/{ip/ip_link_spec.rb → ip_link_spec.rb} +0 -0
  21. data/spec/functional/core/{ip/ip_maddress_spec.rb → ip_maddress_spec.rb} +0 -0
  22. data/spec/functional/core/{ip/ip_neighbour_spec.rb → ip_neighbour_spec.rb} +0 -0
  23. data/spec/functional/core/{ip/ip_route_spec.rb → ip_route_spec.rb} +0 -0
  24. data/spec/functional/core/{ip/ip_rule_spec.rb → ip_rule_spec.rb} +0 -0
  25. data/spec/functional/core/{ip/ip_spec.rb → ip_spec.rb} +0 -0
  26. data/spec/functional/core/zypper_spec.rb +708 -0
  27. data/spec/helper/stub_network.rb +1 -1
  28. metadata +11 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd7661452984fde76a67c205c6de2fc65ef6dd4eca517ff207677ddac0adfe25
4
- data.tar.gz: 0ff31a1685bb616fb4039da422544944ba3b713a00a3941ccb8a4fa03d753def
3
+ metadata.gz: a6038052274021235b996bc9f7ade893cd10d6881c86e563f2b2d382abb16d60
4
+ data.tar.gz: cdec7058f5ed36cb0e1132be77c01085eed95267249f36458c6a591e02f27fbc
5
5
  SHA512:
6
- metadata.gz: 7e7ba4e672987e7650c5a0ce288f38fac309514a2670ec705eb7df8880f7b805a45ee3ed961366bed2981d8113a32343fe1d403e3c6cd96a3e77a327a6e3272f
7
- data.tar.gz: 1821f242cd12a8b246d30a2079741988bd36f12df58d2e18551c8f416b6048ed1005cafb48faf33d0741da16a3fd0ccf2487d6c6166b497c54406dcb5aee67cd
6
+ metadata.gz: a3ef7552d342a0b2fd0cf85fd1bbc03752d24803052feb9639c59d0244f3340edc85f038b2d3d296e0a2d85d468d45bcdde61b79cfd8d9ca8027cc217bf2f615
7
+ data.tar.gz: a6a4f401e579ff750ca46b5580b259eeb8e25998c76e98612a5123daf4ecef4fbe22fb5bf3f6a19337190afae86a0c87d5319757205e99dfcc8faa2a5de11376
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## Kanrisuru 0.16.2 (December 19, 2021) ##
2
+ * Organize functional ip specs
3
+ * Log in realtime, debug output the stdout from the remote server, as opposed to waiting until after the command is done.
4
+ * Fix the `opensuse_leap` for the stubnetwork rspec helper.
5
+ * Refactor and cleanup the `append_array` method for the `Kanrisuru::Command` instance
6
+ * Move `gpg_opts` for `zypper` command into re-usable method
7
+ * Add functional test cases for `zypper` command.
8
+
1
9
  ## Kanrisuru 0.16.1 (December 16, 2021) ##
2
10
  * Fix require class for `os_package`.
3
11
 
@@ -88,11 +88,10 @@ module Kanrisuru
88
88
  append_value("| #{value}")
89
89
  end
90
90
 
91
- def append_array(value)
91
+ def append_array(value, separator = ' ')
92
92
  return unless Kanrisuru::Util.present?(value)
93
93
 
94
- value = [value] unless value.instance_of?(Array)
95
- append_value(value.join(' '))
94
+ append_value(Kanrisuru::Util.array_join_string(value, separator))
96
95
  end
97
96
 
98
97
  def append_value(value)
@@ -17,16 +17,9 @@ module Kanrisuru
17
17
  command.append_flag('--no-refresh', opts[:no_refresh])
18
18
  command.append_flag('--keep-packages', opts[:keep_packages])
19
19
  command.append_flag('--no-keep-packages', opts[:no_keep_packages])
20
- command.append_flag('--gpgcheck', opts[:gpgcheck])
21
- command.append_flag('--gpgcheck-strict', opts[:gpgcheck_strict])
22
- command.append_flag('--gpgcheck-allow-unsigned', opts[:gpgcheck_allow_unsigned])
23
- command.append_flag('--gpgcheck-allow-unsigned-repo', opts[:gpgcheck_allow_unsigned_repo])
24
- command.append_flag('--gpgcheck-allow-unsigned-package', opts[:gpgcheck_allow_unsigned_package])
25
- command.append_flag('--no-gpgcheck', opts[:no_gpgcheck])
26
- command.append_flag('--default-gpgcheck', opts[:default_gpgcheck])
27
-
28
20
  command.append_arg('--priority', opts[:priority])
29
21
 
22
+ zypper_gpg_opts(command, opts)
30
23
  zypper_repos_opt(command, opts)
31
24
 
32
25
  execute_shell(command)
@@ -8,14 +8,16 @@ module Kanrisuru
8
8
  zypper_global_opts(command, opts)
9
9
  command << 'addservice'
10
10
 
11
- command.append_arg('--name', opts[:name])
11
+ name = ("'#{opts[:name]}'" if Kanrisuru::Util.present?(opts[:name]))
12
12
 
13
+ command.append_arg('--name', name)
13
14
  command.append_flag('--enable', opts[:enable])
14
15
  command.append_flag('--disable', opts[:disable])
15
16
  command.append_flag('--refresh', opts[:refresh])
16
17
  command.append_flag('--no-refresh', opts[:no_refresh])
17
18
 
18
- command.append_array(opts[:services])
19
+ command << opts[:service]
20
+ command << opts[:alias]
19
21
 
20
22
  execute_shell(command)
21
23
 
@@ -11,8 +11,7 @@ module Kanrisuru
11
11
  zypper_repos_opt(command, opts)
12
12
  zypper_package_type_opt(command, opts)
13
13
 
14
- packages = Kanrisuru::Util.array_join_string(opts[:packages], ' ')
15
- command << packages
14
+ command.append_array(opts[:packages])
16
15
 
17
16
  execute_shell(command)
18
17
 
@@ -12,7 +12,7 @@ module Kanrisuru
12
12
  zypper_package_type_opt(command, opts)
13
13
 
14
14
  command.append_arg('-n', opts[:name])
15
- command.append_arg('-f', opts[:force])
15
+ command.append_flag('-f', opts[:force])
16
16
  command.append_flag('--oldpackage', opts[:oldpackage])
17
17
  command.append_arg('--from', opts[:from])
18
18
  command.append_arg('--capability', opts[:capability])
@@ -27,8 +27,7 @@ module Kanrisuru
27
27
  zypper_download_and_install_opts(command, opts)
28
28
  zypper_expert_opts(command, opts)
29
29
 
30
- packages = Kanrisuru::Util.array_join_string(opts[:packages], ' ')
31
- command << packages
30
+ command.append_array(opts[:packages])
32
31
 
33
32
  execute_shell(command)
34
33
 
@@ -19,13 +19,7 @@ module Kanrisuru
19
19
  command.append_flag('--keep-packages', opts[:keep_packages])
20
20
  command.append_flag('--no-keep-packages', opts[:no_keep_packages])
21
21
 
22
- command.append_flag('--gpgcheck', opts[:gpgcheck])
23
- command.append_flag('--gpgcheck-strict', opts[:gpgcheck_strict])
24
- command.append_flag('--gpgcheck-allow-unsigned', opts[:gpgcheck_allow_unsigned])
25
- command.append_flag('--gpgcheck-allow-unsigned-repo', opts[:gpgcheck_allow_unsigned_repo])
26
- command.append_flag('--gpgcheck-allow-unsigned-package', opts[:gpgcheck_allow_unsigned_package])
27
- command.append_flag('--no-gpgcheck', opts[:no_gpgcheck])
28
- command.append_flag('--default-gpgcheck', opts[:default_gpgcheck])
22
+ zypper_gpg_opts(command, opts)
29
23
 
30
24
  command.append_flag('--all', opts[:all])
31
25
  command.append_flag('--local', opts[:local])
@@ -8,8 +8,8 @@ module Kanrisuru
8
8
  zypper_global_opts(command, opts)
9
9
 
10
10
  command << 'modifyservice'
11
- command.append_arg('--name', opts[:name])
12
11
 
12
+ command.append_arg('--name', opts[:name])
13
13
  command.append_flag('--enable', opts[:enable])
14
14
  command.append_flag('--disable', opts[:disable])
15
15
  command.append_flag('--refresh', opts[:refresh])
@@ -31,6 +31,8 @@ module Kanrisuru
31
31
  command.append_arg('--medium-type', opts[:medium_type])
32
32
  end
33
33
 
34
+ command << opts[:service] if Kanrisuru::Util.present?(opts[:service])
35
+
34
36
  execute_shell(command)
35
37
 
36
38
  Kanrisuru::Result.new(command)
@@ -15,8 +15,7 @@ module Kanrisuru
15
15
  zypper_package_type_opt(command, opts)
16
16
  zypper_solver_opts(command, opts)
17
17
 
18
- packages = Kanrisuru::Util.array_join_string(opts[:packages], ' ')
19
- command << packages
18
+ command.append_array(opts[:packages])
20
19
 
21
20
  execute_shell(command)
22
21
  Kanrisuru::Result.new(command)
@@ -15,10 +15,10 @@ module Kanrisuru
15
15
  command.append_flag('--local', opts[:local])
16
16
  command.append_flag('--remote', opts[:remote])
17
17
 
18
- if Kanrisuru::Util.present?(opts[:media_type])
19
- raise ArgumentError, 'Invalid media type' unless ZYPPER_MEDIA_TYPES.include?(opts[:media_type])
18
+ if Kanrisuru::Util.present?(opts[:medium_type])
19
+ raise ArgumentError, 'Invalid media type' unless MEDIUM_TYPES.include?(opts[:medium_type])
20
20
 
21
- command.append_arg('--media-type', opts[:media_type])
21
+ command.append_arg('--medium-type', opts[:medium_type])
22
22
  end
23
23
 
24
24
  command.append_array(opts[:repos])
@@ -4,13 +4,18 @@ module Kanrisuru
4
4
  module Core
5
5
  module Zypper
6
6
  def zypper_remove_service(opts)
7
+ service = opts[:service]
8
+
7
9
  command = Kanrisuru::Command.new('zypper')
8
10
  zypper_global_opts(command, opts)
9
11
 
10
12
  command << 'removeservice'
11
13
  command.append_flag('--loose-auth', opts[:loose_auth])
12
14
  command.append_flag('--loose-query', opts[:loose_query])
13
- command.append_array(opts[:services])
15
+
16
+ service = "'#{service}'" if service.match(/\s/)
17
+
18
+ command << service
14
19
 
15
20
  execute_shell(command)
16
21
 
@@ -37,9 +37,7 @@ module Kanrisuru
37
37
 
38
38
  zypper_repos_opt(command, opts)
39
39
  zypper_package_type_opt(command, opts)
40
-
41
- packages = Kanrisuru::Util.array_join_string(opts[:packages], ' ')
42
- command << packages
40
+ command.append_array(opts[:packages])
43
41
 
44
42
  execute_shell(command)
45
43
 
@@ -13,6 +13,8 @@ module Kanrisuru
13
13
  command.append_flag('--no-build-deps', opts[:no_build_deps])
14
14
  command.append_flag('--download-only', opts[:download_only])
15
15
 
16
+ command.append_array(opts[:packages])
17
+
16
18
  execute_shell(command)
17
19
 
18
20
  Kanrisuru::Result.new(command)
@@ -76,6 +76,16 @@ module Kanrisuru
76
76
  command.append_flag('--no-allow-vendor-change', opts[:no_allow_vendor_change])
77
77
  end
78
78
 
79
+ def zypper_gpg_opts(command, opts)
80
+ command.append_flag('--gpgcheck', opts[:gpgcheck])
81
+ command.append_flag('--gpgcheck-strict', opts[:gpgcheck_strict])
82
+ command.append_flag('--gpgcheck-allow-unsigned', opts[:gpgcheck_allow_unsigned])
83
+ command.append_flag('--gpgcheck-allow-unsigned-repo', opts[:gpgcheck_allow_unsigned_repo])
84
+ command.append_flag('--gpgcheck-allow-unsigned-package', opts[:gpgcheck_allow_unsigned_package])
85
+ command.append_flag('--no-gpgcheck', opts[:no_gpgcheck])
86
+ command.append_flag('--default-gpgcheck', opts[:default_gpgcheck])
87
+ end
88
+
79
89
  def zypper_repos_opt(command, opts)
80
90
  zypper_array_opt(command, opts[:repos], '--repo')
81
91
  end
@@ -101,7 +111,6 @@ module Kanrisuru
101
111
 
102
112
  def zypper_package_type_opt(command, opts)
103
113
  type = opts[:type]
104
-
105
114
  command.append_arg('-t', type) if Kanrisuru::Util.present?(type) && PACKAGE_TYPES.include?(type)
106
115
  end
107
116
  end
@@ -135,6 +135,7 @@ module Kanrisuru
135
135
  end
136
136
 
137
137
  ch.on_data do |_, data|
138
+ Kanrisuru.logger.debug { data.strip }
138
139
  command.handle_data(data)
139
140
  end
140
141
 
@@ -145,9 +146,6 @@ module Kanrisuru
145
146
  end
146
147
 
147
148
  channel.wait
148
-
149
- Kanrisuru.logger.debug { command.to_a }
150
-
151
149
  command
152
150
  rescue Net::SSH::ConnectionTimeout, Net::SSH::Timeout => e
153
151
  if retry_attempts > 1
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.16.1'
4
+ VERSION = '0.16.2'
5
5
  end
File without changes
@@ -0,0 +1,708 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Kanrisuru::Core::Zypper do
6
+ before(:all) do
7
+ StubNetwork.stub!(:opensuse)
8
+ end
9
+
10
+ after(:all) do
11
+ StubNetwork.unstub!
12
+ end
13
+
14
+ let(:host) do
15
+ Kanrisuru::Remote::Host.new(
16
+ host: 'opensuse-host',
17
+ username: 'opensuse',
18
+ keys: ['id_rsa']
19
+ )
20
+ end
21
+
22
+ %w[addlock al].each do |action_variant|
23
+ it "prepares #{action_variant} command" do
24
+ expect_command(host.zypper(action_variant, lock: 'nginx'),
25
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev addlock nginx')
26
+
27
+ expect_command(host.zypper(action_variant,
28
+ lock: 'nginx',
29
+ type: 'package',
30
+ config_file: '/etc/zypp/zypp.conf'),
31
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --config /etc/zypp/zypp.conf addlock -t package nginx')
32
+ end
33
+ end
34
+
35
+ %w[locks ll].each do |action_variant|
36
+ it "prepares #{action_variant} command" do
37
+ expect_command(host.zypper(action_variant),
38
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet locks --matches')
39
+ end
40
+ end
41
+
42
+ %w[removelock rl].each do |action_variant|
43
+ it "prepares #{action_variant} command" do
44
+ expect_command(host.zypper(action_variant, lock: 'gcc'),
45
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev removelock gcc')
46
+
47
+ expect_command(host.zypper(action_variant, lock: 'gcc', type: 'patch'),
48
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev removelock -t patch gcc')
49
+ end
50
+ end
51
+
52
+ %w[cleanlocks cl].each do |action_variant|
53
+ it "prepares #{action_variant} command" do
54
+ expect_command(host.zypper(action_variant),
55
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev cleanlocks')
56
+ end
57
+ end
58
+
59
+ %w[repos lr].each do |action_variant|
60
+ it "prepares #{action_variant} command" do
61
+ expect_command(host.zypper(action_variant),
62
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev repos --details')
63
+ end
64
+ end
65
+
66
+ %w[refresh ref].each do |action_variant|
67
+ it "prepares #{action_variant} command" do
68
+ expect_command(host.zypper(action_variant),
69
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev refresh')
70
+
71
+ expect_command(host.zypper(action_variant,
72
+ force: true,
73
+ force_build: true,
74
+ force_download: true,
75
+ build_only: true,
76
+ download_only: true),
77
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev refresh --force --force-build --force-download --build-only --download-only')
78
+ end
79
+ end
80
+
81
+ %w[modifyrepo mr].each do |action_variant|
82
+ it "prepares #{action_variant} command" do
83
+ expect_command(host.zypper(action_variant, repos: 'graphics'),
84
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo graphics')
85
+
86
+ expect_command(host.zypper(action_variant,
87
+ repos: 'graphics',
88
+ name: 'graphics-alias',
89
+ priority: 1),
90
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --name graphics-alias --priority 1 graphics')
91
+
92
+ expect_command(host.zypper(action_variant,
93
+ disable: true,
94
+ remote: true),
95
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --disable --remote')
96
+
97
+ expect_command(host.zypper(action_variant,
98
+ enable: true,
99
+ local: true),
100
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --enable --local')
101
+
102
+ expect_command(host.zypper(action_variant,
103
+ refresh: true,
104
+ all: true),
105
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --refresh --all')
106
+
107
+ expect_command(host.zypper(action_variant,
108
+ no_refresh: true,
109
+ all: true),
110
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --no-refresh --all')
111
+
112
+ expect_command(host.zypper(action_variant,
113
+ keep_packages: true,
114
+ all: true),
115
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --keep-packages --all')
116
+
117
+ expect_command(host.zypper(action_variant,
118
+ no_keep_packages: true,
119
+ all: true),
120
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --no-keep-packages --all')
121
+
122
+ expect_command(host.zypper(action_variant,
123
+ gpgcheck: true,
124
+ gpgcheck_strict: true,
125
+ gpgcheck_allow_unsigned: true,
126
+ gpgcheck_allow_unsigned_repo: true,
127
+ gpgcheck_allow_unsigned_package: true,
128
+ default_gpgcheck: true),
129
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --gpgcheck --gpgcheck-strict --gpgcheck-allow-unsigned --gpgcheck-allow-unsigned-repo --gpgcheck-allow-unsigned-package --default-gpgcheck')
130
+
131
+ expect_command(host.zypper(action_variant,
132
+ medium_type: 'file'),
133
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyrepo --medium-type file')
134
+
135
+ expect do
136
+ host.zypper(action_variant, medium_type: 'tap')
137
+ end.to raise_error(ArgumentError)
138
+ end
139
+ end
140
+
141
+ %w[addrepo ar].each do |action_variant|
142
+ it "prepares #{action_variant} command" do
143
+ expect_command(host.zypper(action_variant, repos: 'graphics'),
144
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev addrepo --repo graphics')
145
+
146
+ expect_command(host.zypper(action_variant, repos: %w[graphics repo-debug]),
147
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev addrepo --repo graphics --repo repo-debug')
148
+
149
+ expect_command(host.zypper(action_variant,
150
+ check: true,
151
+ enable: true,
152
+ refresh: true,
153
+ keep_packages: true,
154
+ gpgcheck: true,
155
+ gpgcheck_strict: true,
156
+ gpgcheck_allow_unsigned: true,
157
+ gpgcheck_allow_unsigned_repo: true,
158
+ gpgcheck_allow_unsigned_package: true,
159
+ default_gpgcheck: true,
160
+ repos: 'graphics'),
161
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev addrepo --check --enable --refresh --keep-packages --gpgcheck --gpgcheck-strict --gpgcheck-allow-unsigned --gpgcheck-allow-unsigned-repo --gpgcheck-allow-unsigned-package --default-gpgcheck --repo graphics')
162
+
163
+ expect_command(host.zypper(action_variant,
164
+ no_check: true,
165
+ disable: true,
166
+ no_refresh: true,
167
+ no_keep_packages: true,
168
+ priority: true,
169
+ no_gpgcheck: true,
170
+ repos: 'graphics'), 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev addrepo --no-check --disable --no-refresh --no-keep-packages --priority true --no-gpgcheck --repo graphics')
171
+ end
172
+ end
173
+
174
+ %w[removerepo rr].each do |action_variant|
175
+ it "prepares #{action_variant} command" do
176
+ expect_command(host.zypper(action_variant, repos: 'graphics'),
177
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev removerepo graphics')
178
+
179
+ expect_command(host.zypper(action_variant,
180
+ repos: %w[graphics repo-debug],
181
+ loose_auth: true,
182
+ loose_query: true,
183
+ all: true,
184
+ medium_type: 'nfs'),
185
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev removerepo --loose-auth --loose-query --all --medium-type nfs graphics repo-debug')
186
+
187
+ expect_command(host.zypper(action_variant,
188
+ repos: %w[graphics repo-debug],
189
+ local: true,
190
+ remote: true),
191
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev removerepo --local --remote graphics repo-debug')
192
+
193
+ expect do
194
+ host.zypper(action_variant, repos: %w[graphics repo-debug], medium_type: 'floppy')
195
+ end.to raise_error(ArgumentError)
196
+ end
197
+ end
198
+
199
+ %w[renamerepo nr].each do |action_variant|
200
+ it "prepares #{action_variant} command" do
201
+ expect_command(host.zypper(action_variant, repo: 'graphics', alias: 'graphics-alias'),
202
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev renamerepo graphics graphics-alias')
203
+ end
204
+ end
205
+
206
+ %w[addservice as].each do |action_variant|
207
+ it "prepares #{action_variant} command" do
208
+ expect_command(host.zypper(action_variant,
209
+ service: 'https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/',
210
+ alias: 'repo-database'),
211
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev addservice https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/ repo-database')
212
+
213
+ expect_command(host.zypper(action_variant,
214
+ service: 'https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/',
215
+ alias: 'repo-database',
216
+ disable: true,
217
+ refresh: true),
218
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev addservice --disable --refresh https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/ repo-database')
219
+
220
+ expect_command(host.zypper(action_variant,
221
+ service: 'https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/',
222
+ name: 'Database Repository',
223
+ enable: true,
224
+ no_refresh: true,
225
+ alias: 'repo-database'),
226
+ "zypper --non-interactive --ignore-unknown --no-color --no-abbrev addservice --name 'Database Repository' --enable --no-refresh https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/ repo-database")
227
+ end
228
+ end
229
+
230
+ %w[removeservice rs].each do |action_variant|
231
+ it "prepares #{action_variant} command" do
232
+ expect_command(host.zypper(action_variant, service: 'repo-source-non-oss'),
233
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev removeservice repo-source-non-oss')
234
+
235
+ expect_command(host.zypper(action_variant,
236
+ loose_auth: true,
237
+ loose_query: true,
238
+ service: 'https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/'),
239
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev removeservice --loose-auth --loose-query https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/')
240
+
241
+ expect_command(host.zypper(action_variant, service: 'Debug Repository (Non-OSS)'),
242
+ "zypper --non-interactive --ignore-unknown --no-color --no-abbrev removeservice 'Debug Repository (Non-OSS)'")
243
+ end
244
+ end
245
+
246
+ %w[modifyservice ms].each do |action_variant|
247
+ it "prepares #{action_variant} command" do
248
+ expect_command(host.zypper(action_variant, service: 'repo-database', no_refresh: true, enable: true),
249
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --enable --no-refresh repo-database')
250
+
251
+ expect_command(host.zypper(action_variant,
252
+ service: 'https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/',
253
+ name: "'Database Repository OSS'",
254
+ disable: true,
255
+ refresh: true),
256
+ "zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --name 'Database Repository OSS' --disable --refresh https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/")
257
+
258
+ expect_command(host.zypper(action_variant,
259
+ all: true),
260
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --all')
261
+
262
+ expect_command(host.zypper(action_variant,
263
+ local: true),
264
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --local')
265
+
266
+ expect_command(host.zypper(action_variant,
267
+ remote: true),
268
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --remote')
269
+
270
+ expect_command(host.zypper(action_variant,
271
+ medium_type: 'http',
272
+ disable: true),
273
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --disable --medium-type http')
274
+
275
+ expect do
276
+ host.zypper(action_variant, medium_type: 'rar')
277
+ end.to raise_error(ArgumentError)
278
+
279
+ expect_command(host.zypper(action_variant,
280
+ ar_to_enable: 'SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool'),
281
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --ar-to-enable SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool')
282
+
283
+ expect_command(host.zypper(action_variant,
284
+ ar_to_disable: 'SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool'),
285
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --ar-to-disable SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool')
286
+
287
+ expect_command(host.zypper(action_variant,
288
+ rr_to_enable: 'SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool'),
289
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --rr-to-enable SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool')
290
+
291
+ expect_command(host.zypper(action_variant,
292
+ rr_to_disable: 'SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool'),
293
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --rr-to-disable SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool')
294
+
295
+ expect_command(host.zypper(action_variant,
296
+ cl_to_enable: 'SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool'),
297
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --cl-to-enable SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool')
298
+
299
+ expect_command(host.zypper(action_variant,
300
+ cl_to_disable: 'SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool'),
301
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev modifyservice --cl-to-disable SMT-http_usanlx_pc_corp_com:SLES11-SP2-pool')
302
+ end
303
+ end
304
+
305
+ %w[services ls].each do |action_variant|
306
+ it "prepares #{action_variant} command" do
307
+ expect_command(host.zypper(action_variant),
308
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev services --details')
309
+ end
310
+ end
311
+
312
+ %w[refresh-services refs].each do |action_variant|
313
+ it "prepares #{action_variant} command" do
314
+ expect_command(host.zypper(action_variant),
315
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev refresh-services')
316
+
317
+ expect_command(host.zypper(action_variant, force: true, with_repos: true, restore_status: true),
318
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev refresh-services --force --with-repos --restore-status')
319
+ end
320
+ end
321
+
322
+ %w[info if].each do |action_variant|
323
+ it "prepares #{action_variant} command" do
324
+ expect_command(host.zypper(action_variant, packages: 'workrave'),
325
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev info workrave')
326
+
327
+ expect_command(host.zypper(action_variant, packages: %w[nginx curl]),
328
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev info nginx curl')
329
+
330
+ expect_command(host.zypper(action_variant, packages: 'go', type: 'package'),
331
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev info -t package go')
332
+
333
+ expect_command(host.zypper(action_variant, packages: %w[ffmpeg gcc], repos: 'repo-oss'),
334
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev info --repo repo-oss ffmpeg gcc')
335
+
336
+ expect_command(host.zypper(action_variant, packages: %w[ffmpeg gcc], repos: %w[repo-oss packman]),
337
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev info --repo repo-oss --repo packman ffmpeg gcc')
338
+ end
339
+ end
340
+
341
+ %w[install in].each do |action_variant|
342
+ it "prepares #{action_variant} command" do
343
+ expect_command(host.zypper(action_variant, packages: 'nginx'),
344
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install nginx')
345
+
346
+ expect_command(host.zypper(action_variant,
347
+ packages: %w[nginx curl],
348
+ repos: 'repo-oss',
349
+ oldpackage: true,
350
+ auto_agree_with_licenses: true,
351
+ auto_agree_with_product_licenses: true,
352
+ replacefiles: true,
353
+ dry_run: true,
354
+ allow_unsigned_rpm: true),
355
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install --repo repo-oss --oldpackage --auto-agree-with-licenses --auto-agree-with-product-licenses --replacefiles --dry-run --allow-unsigned-rpm nginx curl')
356
+
357
+ expect_command(host.zypper(action_variant,
358
+ name: 'nginx',
359
+ force: true),
360
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install -n nginx -f')
361
+
362
+ expect_command(host.zypper(action_variant,
363
+ name: 'nginx',
364
+ force: true,
365
+ download_only: true,
366
+ download_in_advance: true,
367
+ download_in_heaps: true,
368
+ download_as_needed: true),
369
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install -n nginx -f --download-only --download-in-advance --download-in-heaps --download-as-needed')
370
+
371
+ expect_command(host.zypper(action_variant,
372
+ type: 'srcpackage',
373
+ allow_unsigned_rpm: true,
374
+ allow_downgrade: true,
375
+ allow_name_change: true,
376
+ allow_arch_change: true,
377
+ allow_vendor_change: true,
378
+ debug_solver: true,
379
+ force_resolution: true,
380
+ solver_focus_mode: 'update',
381
+ clean_deps: true),
382
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install -t srcpackage --allow-unsigned-rpm --debug-solver --force-resolution --solver-focus update --clean-deps --allow-downgrade --allow-name-change --allow-arch-change --allow-vendor-change')
383
+
384
+ expect_command(host.zypper(action_variant,
385
+ from: 'https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/',
386
+ capability: true,
387
+ no_force_resolution: true,
388
+ no_allow_downgrade: true,
389
+ no_allow_name_change: true,
390
+ no_allow_arch_change: true,
391
+ no_allow_vendor_change: true),
392
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install --from https://download.opensuse.org/repositories/server:/database/openSUSE_Leap_15.2/ --capability true --no-force-resolution --no-allow-downgrade --no-allow-name-change --no-allow-arch-change --no-allow-vendor-change')
393
+ end
394
+ end
395
+
396
+ %w[source-install si].each do |action_variant|
397
+ it "prepares #{action_variant} command" do
398
+ expect_command(host.zypper(action_variant, packages: 'python-pip', build_deps_only: true),
399
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev sourceinstall --build-deps-only python-pip')
400
+
401
+ expect_command(host.zypper(action_variant,
402
+ packages: %w[python-pip i2c-tools],
403
+ no_build_deps_only: true,
404
+ download_only: true),
405
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev sourceinstall --download-only python-pip i2c-tools')
406
+
407
+ expect_command(host.zypper(action_variant, repos: 'packman', packages: 'bind'),
408
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev sourceinstall --repo packman bind')
409
+
410
+ expect_command(host.zypper(action_variant, repos: %w[packman repo-oss], packages: %w[bind apache2]),
411
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev sourceinstall --repo packman --repo repo-oss bind apache2')
412
+ end
413
+ end
414
+
415
+ %w[verify ve].each do |action_variant|
416
+ it "prepares #{action_variant} command" do
417
+ expect_command(host.zypper(action_variant),
418
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev verify')
419
+
420
+ expect_command(host.zypper(action_variant, dry_run: true, repos: 'repo-oss'),
421
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev verify --dry-run --repo repo-oss')
422
+
423
+ expect_command(host.zypper(action_variant, dry_run: true, repos: %w[repo-oss packman]),
424
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev verify --dry-run --repo repo-oss --repo packman')
425
+ end
426
+ end
427
+
428
+ %w[install-new-recommends inr].each do |action_variant|
429
+ it "prepares #{action_variant} command" do
430
+ expect_command(host.zypper(action_variant),
431
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install-new-recommends')
432
+
433
+ expect_command(host.zypper(action_variant, dry_run: true, repos: 'repo-update'),
434
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install-new-recommends --dry-run --repo repo-update')
435
+
436
+ expect_command(host.zypper(action_variant, repos: %w[repo-update repo-update-non-oss]),
437
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev install-new-recommends --repo repo-update --repo repo-update-non-oss')
438
+ end
439
+ end
440
+
441
+ %w[remove rm].each do |action_variant|
442
+ it "prepares #{action_variant} command" do
443
+ expect_command(host.zypper(action_variant, packages: 'nginx'),
444
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev remove nginx')
445
+
446
+ expect_command(host.zypper(action_variant,
447
+ packages: %w[nginx apache2 curl],
448
+ dry_run: true,
449
+ capability: true,
450
+ repos: %w[packman repo-update repo-oss]),
451
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev remove --dry-run --capability --repo packman --repo repo-update --repo repo-oss nginx apache2 curl')
452
+ end
453
+ end
454
+
455
+ it 'prepares purge-kernels command' do
456
+ expect_command(host.zypper('purge-kernels'),
457
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev purge-kernels')
458
+ expect_command(host.zypper('purge-kernels', dry_run: true),
459
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev purge-kernels --dry-run')
460
+ end
461
+
462
+ %w[search se].each do |action_variant|
463
+ it "prepares #{action_variant} command" do
464
+ expect_command(host.zypper(action_variant, packages: 'nginx'),
465
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev search --details nginx')
466
+
467
+ expect_command(host.zypper(action_variant, packages: %w[nginx curl], match_exact: true),
468
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev search --details --match-exact nginx curl')
469
+
470
+ expect_command(host.zypper(action_variant,
471
+ packages: %w[nginx curl],
472
+ match_substrings: true,
473
+ match_words: true,
474
+ provides: true,
475
+ requires: true,
476
+ recommends: true,
477
+ suggests: true,
478
+ conflicts: true,
479
+ obsoletes: true),
480
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev search --details --match-substrings --match-words --provides --requires --recommends --suggests --conflicts --obsoletes nginx curl')
481
+
482
+ expect_command(host.zypper(action_variant,
483
+ packages: %w[kernel gcc],
484
+ installed_only: true,
485
+ sort_by_repo: true,
486
+ supplements: true,
487
+ provides_pkg: true,
488
+ requires_pkg: true,
489
+ recommends_pkg: true,
490
+ supplements_pkg: true,
491
+ conflicts_pkg: true,
492
+ obsoletes_pkg: true,
493
+ suggests_pkg: true), 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev search --details --supplements --provides-pkg --requires-pkg --recommends-pkg --supplements-pkg --conflicts-pkg --obsoletes-pkg --suggests-pkg --installed-only --sort-by-repo kernel gcc')
494
+
495
+ expect_command(host.zypper(action_variant,
496
+ packages: %w[kernel gcc],
497
+ name: true,
498
+ file_list: true,
499
+ search_descriptions: true,
500
+ case_sensitive: true,
501
+ not_installed_only: true,
502
+ sort_by_name: true),
503
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev search --details --name --file-list --search-descriptions --case-sensitive --not-installed-only --sort-by-name kernel gcc')
504
+ end
505
+ end
506
+
507
+ %w[clean cc].each do |action_variant|
508
+ it "prepares #{action_variant} command" do
509
+ expect_command(host.zypper(action_variant),
510
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev clean')
511
+
512
+ expect_command(host.zypper(action_variant, all: true),
513
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev clean --all')
514
+
515
+ expect_command(host.zypper(action_variant, repos: 'pacman'),
516
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev clean pacman')
517
+
518
+ expect_command(host.zypper(action_variant, repos: %w[pacman repo-oss]),
519
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev clean pacman repo-oss')
520
+
521
+ expect_command(host.zypper(action_variant, metadata: true, raw_metadata: true),
522
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev clean --metadata --raw-metadata')
523
+ end
524
+ end
525
+
526
+ %w[list-updates lu].each do |action_variant|
527
+ it "prepares #{action_variant} command" do
528
+ expect_command(host.zypper(action_variant),
529
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-updates')
530
+
531
+ expect_command(host.zypper(action_variant,
532
+ repos: 'repo-source-non-oss',
533
+ type: 'application',
534
+ all: true,
535
+ best_effort: true),
536
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-updates --repo repo-source-non-oss -t application --all --best-effort')
537
+
538
+ expect_command(host.zypper(action_variant, type: 'patch'),
539
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches')
540
+ end
541
+ end
542
+
543
+ %w[list-patches lp].each do |action_variant|
544
+ it "prepares #{action_variant} command" do
545
+ expect_command(host.zypper(action_variant),
546
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches')
547
+
548
+ expect_command(host.zypper(action_variant, bugzilla: '972197'),
549
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --bugzilla 972197')
550
+
551
+ expect_command(host.zypper(action_variant, cve: 'CVE-2016-2315'),
552
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --cve CVE-2016-2315')
553
+
554
+ expect_command(host.zypper(action_variant, date: '2021-12-31'),
555
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --date 2021-12-31')
556
+
557
+ expect_command(host.zypper(action_variant, without_optional: true),
558
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --without-optional')
559
+
560
+ expect_command(host.zypper(action_variant, issues: true),
561
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --issues')
562
+
563
+ expect_command(host.zypper(action_variant, all: true),
564
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --all')
565
+
566
+ expect_command(host.zypper(action_variant, with_optional: true),
567
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --with-optional')
568
+
569
+ expect_command(host.zypper(action_variant, without_optional: true),
570
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --without-optional')
571
+
572
+ expect_command(host.zypper(action_variant, category: 'security'),
573
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --category security')
574
+
575
+ expect_command(host.zypper(action_variant, category: %w[security recommended optional feature]),
576
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --category security --category recommended --category optional --category feature')
577
+
578
+ expect_command(host.zypper(action_variant, severity: 'low'),
579
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --severity low')
580
+
581
+ expect_command(host.zypper(action_variant, severity: %w[critical important moderate]),
582
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --severity critical --severity important --severity moderate')
583
+
584
+ expect_command(host.zypper(action_variant,
585
+ category: %w[security recommended optional feature],
586
+ severity: %w[critical important moderate],
587
+ repos: %w[packman repo-oss]),
588
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet list-patches --category security --category recommended --category optional --category feature --severity critical --severity important --severity moderate --repo packman --repo repo-oss')
589
+ end
590
+ end
591
+
592
+ %w[patch-check pchk].each do |action_variant|
593
+ it "prepares #{action_variant} command" do
594
+ expect_command(host.zypper(action_variant),
595
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet patch-check')
596
+
597
+ expect_command(host.zypper(action_variant, without_optional: true),
598
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet patch-check --without-optional')
599
+
600
+ expect_command(host.zypper(action_variant, updatestack_only: true, with_optional: true),
601
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet patch-check --updatestack-only --with-optional')
602
+
603
+ expect_command(host.zypper(action_variant, updatestack_only: true, with_optional: true),
604
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev --quiet patch-check --updatestack-only --with-optional')
605
+ end
606
+ end
607
+
608
+ it 'prepares patch command' do
609
+ expect_command(host.zypper('patch'), 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch')
610
+ expect_command(host.zypper('patch',
611
+ updatestack_only: true,
612
+ with_update: true,
613
+ with_optional: true,
614
+ replacefiles: true,
615
+ dry_run: true),
616
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --updatestack-only --with-update --with-optional --replacefiles --dry-run')
617
+
618
+ expect_command(host.zypper('patch',
619
+ auto_agree_with_licenses: true,
620
+ auto_agree_with_product_licenses: true),
621
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --auto-agree-with-licenses --auto-agree-with-product-licenses')
622
+
623
+ expect_command(host.zypper('patch', bugzilla: '972197'),
624
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --bugzilla 972197')
625
+
626
+ expect_command(host.zypper('patch', cve: 'CVE-2016-2315'),
627
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --cve CVE-2016-2315')
628
+
629
+ expect_command(host.zypper('patch', date: '2021-12-31'),
630
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --date 2021-12-31')
631
+
632
+ expect_command(host.zypper('patch', category: 'security'),
633
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --category security')
634
+
635
+ expect_command(host.zypper('patch', category: %w[security recommended optional feature]),
636
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --category security --category recommended --category optional --category feature')
637
+
638
+ expect_command(host.zypper('patch', severity: 'low'),
639
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --severity low')
640
+
641
+ expect_command(host.zypper('patch', severity: %w[critical important moderate]),
642
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --severity critical --severity important --severity moderate')
643
+
644
+ expect_command(host.zypper('patch',
645
+ category: %w[security recommended optional feature],
646
+ severity: %w[critical important moderate],
647
+ repos: %w[packman repo-oss],
648
+ debug_solver: true,
649
+ force_resolution: true,
650
+ allow_downgrade: true,
651
+ allow_name_change: true,
652
+ allow_arch_change: true,
653
+ allow_vendor_change: true),
654
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev patch --category security --category recommended --category optional --category feature --severity critical --severity important --severity moderate --repo packman --repo repo-oss --debug-solver --force-resolution --allow-downgrade --allow-name-change --allow-arch-change --allow-vendor-change')
655
+ end
656
+
657
+ %w[dist-upgrade dup].each do |action_variant|
658
+ it "prepares #{action_variant} command" do
659
+ expect_command(host.zypper(action_variant),
660
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev dist-upgrade')
661
+
662
+ expect_command(host.zypper(action_variant, dry_run: true),
663
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev dist-upgrade --dry-run')
664
+
665
+ expect_command(host.zypper(action_variant, auto_agree_with_licenses: true, auto_agree_with_product_licenses: true),
666
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev dist-upgrade --auto-agree-with-licenses --auto-agree-with-product-licenses')
667
+
668
+ expect_command(host.zypper(action_variant, dry_run: true, repos: 'pacman'),
669
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev dist-upgrade --dry-run --repo pacman')
670
+
671
+ expect_command(host.zypper(action_variant,
672
+ repos: %w[packman repo-oss],
673
+ debug_solver: true,
674
+ force_resolution: true,
675
+ allow_downgrade: true,
676
+ allow_name_change: true,
677
+ allow_arch_change: true,
678
+ allow_vendor_change: true),
679
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev dist-upgrade --repo packman --repo repo-oss --debug-solver --force-resolution --allow-downgrade --allow-name-change --allow-arch-change --allow-vendor-change')
680
+ end
681
+ end
682
+
683
+ %w[update up].each do |action_variant|
684
+ it "prepares #{action_variant} command" do
685
+ expect_command(host.zypper(action_variant),
686
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev update')
687
+
688
+ expect_command(host.zypper(action_variant, repos: 'repo-debug-non-oss', type: 'package'),
689
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev update --repo repo-debug-non-oss -t package')
690
+
691
+ expect_command(host.zypper(action_variant,
692
+ repos: %w[repo-debug-non-oss repo-non-oss],
693
+ replacefiles: true,
694
+ best_effort: true,
695
+ dry_run: true),
696
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev update --repo repo-debug-non-oss --repo repo-non-oss --replacefiles --dry-run --best-effort')
697
+
698
+ expect_command(host.zypper(action_variant,
699
+ debug_solver: true,
700
+ force_resolution: true,
701
+ allow_downgrade: true,
702
+ allow_name_change: true,
703
+ allow_arch_change: true,
704
+ allow_vendor_change: true),
705
+ 'zypper --non-interactive --ignore-unknown --no-color --no-abbrev update --debug-solver --force-resolution --allow-downgrade --allow-name-change --allow-arch-change --allow-vendor-change')
706
+ end
707
+ end
708
+ end
@@ -130,7 +130,7 @@ class StubNetwork
130
130
  operating_system: 'GNU/Linux',
131
131
  hardware_platform: 'x86_64',
132
132
  processor: 'x86_64',
133
- release: 'opensuse-leap',
133
+ release: 'opensuse_leap',
134
134
  version: 15.2
135
135
  }
136
136
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanrisuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mammina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-16 00:00:00.000000000 Z
11
+ date: 2021-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel_tests
@@ -446,14 +446,14 @@ files:
446
446
  - spec/functional/core/file_spec.rb
447
447
  - spec/functional/core/find_spec.rb
448
448
  - spec/functional/core/group_spec.rb
449
- - spec/functional/core/ip/ip_address_label_spec.rb
450
- - spec/functional/core/ip/ip_address_spec.rb
451
- - spec/functional/core/ip/ip_link_spec.rb
452
- - spec/functional/core/ip/ip_maddress_spec.rb
453
- - spec/functional/core/ip/ip_neighbour_spec.rb
454
- - spec/functional/core/ip/ip_route_spec.rb
455
- - spec/functional/core/ip/ip_rule_spec.rb
456
- - spec/functional/core/ip/ip_spec.rb
449
+ - spec/functional/core/ip_address_label_spec.rb
450
+ - spec/functional/core/ip_address_spec.rb
451
+ - spec/functional/core/ip_link_spec.rb
452
+ - spec/functional/core/ip_maddress_spec.rb
453
+ - spec/functional/core/ip_neighbour_spec.rb
454
+ - spec/functional/core/ip_route_spec.rb
455
+ - spec/functional/core/ip_rule_spec.rb
456
+ - spec/functional/core/ip_spec.rb
457
457
  - spec/functional/core/mount_spec.rb
458
458
  - spec/functional/core/path_spec.rb
459
459
  - spec/functional/core/socket_spec.rb
@@ -463,6 +463,7 @@ files:
463
463
  - spec/functional/core/transfer_spec.rb
464
464
  - spec/functional/core/user_spec.rb
465
465
  - spec/functional/core/yum_spec.rb
466
+ - spec/functional/core/zypper_spec.rb
466
467
  - spec/functional/remote/cluster_spec.rb
467
468
  - spec/functional/remote/cpu_spec.rb
468
469
  - spec/functional/remote/env_spec.rb