MuranoCLI 3.2.0.beta.9 → 3.2.1.pre.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Rakefile +5 -0
- data/dockers/README.rst +7 -0
- data/dockers/RELEASE.rst +6 -3
- data/dockers/docker-test.sh +45 -17
- data/docs/completions/murano_completion-bash +211 -86
- data/lib/MrMurano/Account.rb +72 -4
- data/lib/MrMurano/Business.rb +163 -2
- data/lib/MrMurano/Commander-Entry.rb +1 -2
- data/lib/MrMurano/Config.rb +19 -18
- data/lib/MrMurano/Content.rb +26 -19
- data/lib/MrMurano/Gateway.rb +51 -10
- data/lib/MrMurano/ReCommander.rb +1 -1
- data/lib/MrMurano/Solution-Services.rb +80 -35
- data/lib/MrMurano/Solution-Users.rb +1 -0
- data/lib/MrMurano/SyncRoot.rb +10 -3
- data/lib/MrMurano/SyncUpDown-Core.rb +47 -36
- data/lib/MrMurano/SyncUpDown-Item.rb +46 -14
- data/lib/MrMurano/SyncUpDown.rb +22 -20
- data/lib/MrMurano/Webservice-Endpoint.rb +20 -18
- data/lib/MrMurano/Webservice-File.rb +63 -20
- data/lib/MrMurano/commands/business.rb +14 -1
- data/lib/MrMurano/commands/child.rb +148 -0
- data/lib/MrMurano/commands/devices.rb +298 -149
- data/lib/MrMurano/commands/element.rb +2 -1
- data/lib/MrMurano/commands/globals.rb +3 -0
- data/lib/MrMurano/commands/network.rb +152 -33
- data/lib/MrMurano/commands/sync.rb +2 -2
- data/lib/MrMurano/commands.rb +1 -0
- data/lib/MrMurano/verbosing.rb +13 -2
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account_spec.rb +43 -11
- data/spec/Content_spec.rb +5 -3
- data/spec/GatewayBase_spec.rb +1 -1
- data/spec/GatewayDevice_spec.rb +47 -8
- data/spec/GatewayResource_spec.rb +1 -1
- data/spec/GatewaySettings_spec.rb +1 -1
- data/spec/HttpAuthed_spec.rb +17 -3
- data/spec/ProjectFile_spec.rb +59 -23
- data/spec/Setting_spec.rb +2 -1
- data/spec/Solution-ServiceConfig_spec.rb +1 -1
- data/spec/Solution-ServiceEventHandler_spec.rb +27 -20
- data/spec/Solution-ServiceModules_spec.rb +7 -5
- data/spec/Solution-UsersRoles_spec.rb +7 -1
- data/spec/Solution_spec.rb +9 -1
- data/spec/SyncRoot_spec.rb +5 -5
- data/spec/SyncUpDown_spec.rb +262 -211
- data/spec/Verbosing_spec.rb +49 -8
- data/spec/Webservice-Cors_spec.rb +10 -1
- data/spec/Webservice-Endpoint_spec.rb +84 -65
- data/spec/Webservice-File_spec.rb +16 -11
- data/spec/Webservice-Setting_spec.rb +7 -1
- data/spec/_workspace.rb +9 -0
- data/spec/cmd_business_spec.rb +5 -10
- data/spec/cmd_common.rb +67 -32
- data/spec/cmd_config_spec.rb +9 -14
- data/spec/cmd_content_spec.rb +15 -26
- data/spec/cmd_cors_spec.rb +9 -12
- data/spec/cmd_device_spec.rb +31 -45
- data/spec/cmd_domain_spec.rb +12 -10
- data/spec/cmd_element_spec.rb +18 -17
- data/spec/cmd_exchange_spec.rb +1 -4
- data/spec/cmd_init_spec.rb +56 -72
- data/spec/cmd_keystore_spec.rb +17 -26
- data/spec/cmd_link_spec.rb +13 -17
- data/spec/cmd_password_spec.rb +9 -10
- data/spec/cmd_setting_application_spec.rb +95 -68
- data/spec/cmd_setting_product_spec.rb +59 -37
- data/spec/cmd_status_spec.rb +46 -84
- data/spec/cmd_syncdown_application_spec.rb +28 -50
- data/spec/cmd_syncdown_both_spec.rb +44 -93
- data/spec/cmd_syncdown_unit_spec.rb +858 -0
- data/spec/cmd_syncup_spec.rb +21 -56
- data/spec/cmd_token_spec.rb +0 -3
- data/spec/cmd_usage_spec.rb +15 -10
- data/spec/dry_run_formatter.rb +1 -0
- data/spec/fixtures/dumped_config +4 -4
- data/spec/spec_helper.rb +3 -0
- metadata +4 -2
@@ -6,7 +6,9 @@
|
|
6
6
|
# Unauthorized copying of this file is strictly prohibited.
|
7
7
|
|
8
8
|
require 'tempfile'
|
9
|
+
require 'webmock'
|
9
10
|
require 'yaml'
|
11
|
+
|
10
12
|
require 'MrMurano/version'
|
11
13
|
require 'MrMurano/HttpAuthed'
|
12
14
|
require 'MrMurano/ProjectFile'
|
@@ -17,8 +19,8 @@ require 'HttpAuthed_spec'
|
|
17
19
|
|
18
20
|
RSpec.describe MrMurano::Webservice::Settings do
|
19
21
|
include_context 'WORKSPACE'
|
22
|
+
|
20
23
|
before(:example) do
|
21
|
-
MrMurano::SyncRoot.instance.reset
|
22
24
|
$cfg = MrMurano::Config.new
|
23
25
|
$cfg.load
|
24
26
|
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
@@ -32,6 +34,10 @@ RSpec.describe MrMurano::Webservice::Settings do
|
|
32
34
|
@base_uri = "#{$cfg['net.protocol']}://#{$cfg['net.host']}/api:1/solution/XYZ/cors"
|
33
35
|
end
|
34
36
|
|
37
|
+
after(:example) do
|
38
|
+
WebMock.reset!
|
39
|
+
end
|
40
|
+
|
35
41
|
it 'initializes' do
|
36
42
|
uri = @srv.endpoint('/')
|
37
43
|
expect(uri.to_s).to eq("#{@base_uri}/")
|
data/spec/_workspace.rb
CHANGED
@@ -10,6 +10,15 @@ require 'pathname'
|
|
10
10
|
require 'tmpdir'
|
11
11
|
|
12
12
|
RSpec.shared_context 'WORKSPACE' do
|
13
|
+
before(:context) do
|
14
|
+
@timeit_time0 = Time.now
|
15
|
+
end
|
16
|
+
|
17
|
+
after(:context) do
|
18
|
+
elapsed_secs = Time.now - @timeit_time0
|
19
|
+
puts "\n .. elapsed: #{elapsed_secs.round(2)} secs."
|
20
|
+
end
|
21
|
+
|
13
22
|
around(:example) do |ex|
|
14
23
|
@testdir = Pathname.new(Dir.pwd).realpath
|
15
24
|
$exited_abnormally = true
|
data/spec/cmd_business_spec.rb
CHANGED
@@ -20,49 +20,44 @@ RSpec.describe 'murano business', :cmd, :needs_password do
|
|
20
20
|
|
21
21
|
context 'list' do
|
22
22
|
it 'as table' do
|
23
|
-
out, err
|
23
|
+
out, err = murano_command_run('business list')
|
24
24
|
expect(err).to eq('')
|
25
25
|
olines = out.lines
|
26
26
|
expect(olines[0]).to match(/^(\+-+){3}\+$/)
|
27
27
|
expect(olines[1]).to match(/^\| bizid\s+\| role\s+\| name\s+\|$/)
|
28
28
|
expect(olines[2]).to match(/^(\+-+){3}\+$/)
|
29
29
|
expect(olines[-1]).to match(/^(\+-+){3}\+$/)
|
30
|
-
expect(status.exitstatus).to eq(0)
|
31
30
|
end
|
32
31
|
|
33
32
|
it 'as json' do
|
34
|
-
out, err
|
33
|
+
out, err = murano_command_run('business list', '-c', 'outformat=json')
|
35
34
|
expect(err).to eq('')
|
36
35
|
expect { JSON.parse(out) }.to_not raise_error
|
37
|
-
expect(status.exitstatus).to eq(0)
|
38
36
|
end
|
39
37
|
|
40
38
|
it 'only ids' do
|
41
|
-
out, err
|
39
|
+
out, err = murano_command_run('business list', '--idonly')
|
42
40
|
expect(err).to eq('')
|
43
41
|
expect(out).to match(/^(\S+\s)*\S+$/)
|
44
|
-
expect(status.exitstatus).to eq(0)
|
45
42
|
end
|
46
43
|
|
47
44
|
it 'output to file' do
|
48
|
-
out, err
|
45
|
+
out, err = murano_command_run('business list', '--idonly', '-o', 'bob')
|
49
46
|
expect(err).to eq('')
|
50
47
|
expect(out).to eq('')
|
51
|
-
expect(status.exitstatus).to eq(0)
|
52
48
|
expect(File.exist?('bob')).to be true
|
53
49
|
data = IO.read('bob')
|
54
50
|
expect(data).to match(/^(\S+\s)*\S+$/)
|
55
51
|
end
|
56
52
|
|
57
53
|
it 'fewer fields' do
|
58
|
-
out, err
|
54
|
+
out, err = murano_command_run('business list', '--brief')
|
59
55
|
expect(err).to eq('')
|
60
56
|
olines = out.lines
|
61
57
|
expect(olines[0]).to match(/^(\+-+)+\+$/)
|
62
58
|
expect(olines[1]).to match(/^(\| \S+\s+)+\|$/)
|
63
59
|
expect(olines[2]).to match(/^(\+-+)+\+$/)
|
64
60
|
expect(olines[-1]).to match(/^(\+-+)+\+$/)
|
65
|
-
expect(status.exitstatus).to eq(0)
|
66
61
|
end
|
67
62
|
end
|
68
63
|
end
|
data/spec/cmd_common.rb
CHANGED
@@ -10,7 +10,9 @@ require 'highline'
|
|
10
10
|
require 'highline/import'
|
11
11
|
require 'os'
|
12
12
|
require 'pathname'
|
13
|
+
require 'rainbow'
|
13
14
|
require 'shellwords'
|
15
|
+
require 'time'
|
14
16
|
require 'timeout'
|
15
17
|
require 'tmpdir'
|
16
18
|
require 'webmock/rspec'
|
@@ -23,30 +25,39 @@ require 'MrMurano/HttpAuthed'
|
|
23
25
|
# - Note that this comes before importing Commander.
|
24
26
|
$exited_abnormally = false
|
25
27
|
|
28
|
+
$catpured_io = false
|
29
|
+
|
26
30
|
def capture_stdio
|
31
|
+
return if $catpured_io
|
27
32
|
$murcli_wasout = $stdout
|
28
33
|
$murcli_waserr = $stderr
|
29
34
|
$murcli_wasterm = $terminal
|
35
|
+
$catpured_io = true
|
30
36
|
end
|
31
37
|
capture_stdio
|
32
38
|
|
33
39
|
def restore_stdio
|
40
|
+
return unless $catpured_io
|
34
41
|
$stdout = $murcli_wasout
|
35
42
|
$stderr = $murcli_waserr
|
36
43
|
$terminal = $murcli_wasterm
|
44
|
+
$murcli_wasout = nil
|
45
|
+
$murcli_waserr = nil
|
46
|
+
$murcli_wasterm = nil
|
47
|
+
$catpured_io = false
|
37
48
|
end
|
38
49
|
|
39
50
|
at_exit do
|
40
51
|
if $exited_abnormally
|
41
52
|
restore_stdio
|
42
53
|
warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
43
|
-
warn(%(
|
44
|
-
warn(%{
|
45
|
-
warn(%(
|
46
|
-
warn(%(
|
47
|
-
warn(%{
|
48
|
-
warn(%(
|
49
|
-
warn(%(
|
54
|
+
warn(%( ____ ))
|
55
|
+
warn(%{ ,%( Y`. })
|
56
|
+
warn(%( / \ ))
|
57
|
+
warn(%( \ () () / ))
|
58
|
+
warn(%{ `. /\ ,%( })
|
59
|
+
warn(%( 8====| "" |====8 ))
|
60
|
+
warn(%( `LLLU' ))
|
50
61
|
warn(%( ))
|
51
62
|
warn('¡Unexpected spec exit killed rspec!')
|
52
63
|
warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
@@ -159,9 +170,9 @@ RSpec.shared_context 'CI_CMD' do
|
|
159
170
|
# *** Utility fcns: Murano Solutions management: create/delete/expunge.
|
160
171
|
|
161
172
|
def murano_solutions_expunge_yes
|
162
|
-
|
163
|
-
|
164
|
-
)
|
173
|
+
# (lb): Cannot really use murano_command_run or murano_command_exits
|
174
|
+
# because we don't know if it'll exit or not.
|
175
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solutions', 'expunge', '-y'))
|
165
176
|
expect(out).to \
|
166
177
|
eq('').or \
|
167
178
|
eq("No solutions found\n").or \
|
@@ -175,53 +186,45 @@ RSpec.shared_context 'CI_CMD' do
|
|
175
186
|
murano_solutions_expunge_yes if defined?(PRE_EXPUNGE) && PRE_EXPUNGE
|
176
187
|
|
177
188
|
@proj_name_prod = rname('MurCLITestProd')
|
178
|
-
|
179
|
-
|
189
|
+
# NOTE: Do not use alias, which resolves to base command, but without options.
|
190
|
+
# E.g., use 'solution create', ...; and not 'product create'.
|
191
|
+
out, err = murano_command_run(
|
192
|
+
'solution create', '--type', 'product', @proj_name_prod, '--save',
|
180
193
|
)
|
181
194
|
expect(err).to eq('')
|
182
195
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
183
|
-
expect(status.exitstatus).to eq(0)
|
184
196
|
|
185
197
|
@proj_name_appy = rname('MurCLITestAppy')
|
186
|
-
out, err
|
187
|
-
|
198
|
+
out, err = murano_command_run(
|
199
|
+
'solution create', '--type', 'application', @proj_name_appy, '--save',
|
188
200
|
)
|
189
201
|
expect(err).to eq('')
|
190
202
|
soln_id = out
|
191
203
|
expect(soln_id.chomp).to match(/^[a-zA-Z0-9]+$/)
|
192
|
-
expect(status.exitstatus).to eq(0)
|
193
204
|
|
194
205
|
project_up_link unless skip_link
|
195
206
|
end
|
196
207
|
|
197
208
|
def project_up_link
|
198
|
-
out, err
|
199
|
-
#expect(out).to a_string_starting_with("Linked product #{@proj_name_prod}")
|
209
|
+
out, err = murano_command_run('assign set')
|
200
210
|
olines = out.lines
|
201
211
|
expect(strip_fancy(olines[0])).to eq(
|
202
212
|
"Linked '#{@proj_name_prod}' to '#{@proj_name_appy}'\n"
|
203
213
|
)
|
204
214
|
expect(olines[1]).to eq("Created default event handler\n")
|
205
215
|
expect(err).to eq('')
|
206
|
-
expect(status.exitstatus).to eq(0)
|
207
216
|
end
|
208
217
|
|
209
218
|
def project_down
|
210
219
|
return if defined?(PRE_EXPUNGE) && PRE_EXPUNGE
|
211
220
|
|
212
|
-
out, err
|
213
|
-
capcmd('murano', 'solution', 'delete', @proj_name_appy, '-y')
|
214
|
-
)
|
221
|
+
out, err = murano_command_run('solution delete', @proj_name_appy, '-y')
|
215
222
|
expect(out).to eq('')
|
216
223
|
expect(err).to eq('')
|
217
|
-
expect(status.exitstatus).to eq(0)
|
218
224
|
|
219
|
-
out, err
|
220
|
-
capcmd('murano', 'solution', 'delete', @proj_name_prod, '-y')
|
221
|
-
)
|
225
|
+
out, err = murano_command_run('solution delete', @proj_name_prod, '-y')
|
222
226
|
expect(out).to eq('')
|
223
227
|
expect(err).to eq('')
|
224
|
-
expect(status.exitstatus).to eq(0)
|
225
228
|
end
|
226
229
|
|
227
230
|
# Utility fcns: Strings.
|
@@ -239,7 +242,7 @@ RSpec.shared_context 'CI_CMD' do
|
|
239
242
|
end
|
240
243
|
|
241
244
|
def strip_color(str)
|
242
|
-
str.gsub(/\e\[
|
245
|
+
str.gsub(/\e\[[;0-9]+m/, '')
|
243
246
|
end
|
244
247
|
|
245
248
|
def strip_fancy(str)
|
@@ -268,6 +271,10 @@ RSpec.shared_context 'CI_CMD' do
|
|
268
271
|
murano_command_runner(cmd, *args)
|
269
272
|
end
|
270
273
|
|
274
|
+
def murano_command_run_gentle(cmd, *args)
|
275
|
+
murano_command_runner(cmd, *args, skip_cfg: true)
|
276
|
+
end
|
277
|
+
|
271
278
|
def murano_command_exits(cmd, *args)
|
272
279
|
murano_command_runner(cmd, *args, wont_run: true)
|
273
280
|
end
|
@@ -276,7 +283,9 @@ RSpec.shared_context 'CI_CMD' do
|
|
276
283
|
murano_command_runner(cmd, *args, wont_parse: true)
|
277
284
|
end
|
278
285
|
|
279
|
-
def murano_command_runner(
|
286
|
+
def murano_command_runner(
|
287
|
+
cmd, *args, wont_run: false, wont_parse: false, skip_cfg: false
|
288
|
+
)
|
280
289
|
# This is a functional test, so tell WebMock to back off.
|
281
290
|
allow_net_conn = WebMock::Config.instance.allow_net_connect != false
|
282
291
|
WebMock.allow_net_connect!
|
@@ -303,10 +312,17 @@ RSpec.shared_context 'CI_CMD' do
|
|
303
312
|
# at_exit, it uses runner.command_exit to tell ReCommander's at_exit
|
304
313
|
# monkey patch not to call Commander.run!. Via rspec, we don't use the
|
305
314
|
# at_exit hook, or ReCommander.
|
306
|
-
|
307
|
-
|
308
|
-
|
315
|
+
unless skip_cfg
|
316
|
+
$cfg = MrMurano::Config.new(::Commander::Runner.instance)
|
317
|
+
$cfg.load
|
318
|
+
$cfg['tool.no-progress'] = true
|
319
|
+
|
320
|
+
# In case the test runner installed a project file.
|
321
|
+
$project = MrMurano::ProjectFile.new
|
322
|
+
$project.load
|
323
|
+
end
|
309
324
|
$cfg.validate_cmd
|
325
|
+
|
310
326
|
runner = ::Commander::Runner.instance
|
311
327
|
unless defined?(runner.command_exit) && runner.command_exit
|
312
328
|
# (lb): Commander's at_exit hook calls runner.run! which runs the
|
@@ -314,6 +330,7 @@ RSpec.shared_context 'CI_CMD' do
|
|
314
330
|
# few different ways to reset Runner.instance, but nothing worked;
|
315
331
|
# our best bet is to just call the command directly.
|
316
332
|
the_cmd = command(cmd.to_sym)
|
333
|
+
raise "Specified command not recognized! “#{cmd}”" if the_cmd.nil?
|
317
334
|
when_called = the_cmd.peek_when_called.dup
|
318
335
|
|
319
336
|
runner.force_args(args.dup)
|
@@ -332,6 +349,12 @@ RSpec.shared_context 'CI_CMD' do
|
|
332
349
|
# This is unexpected. Leave $exited_abnormally so we warn the user.
|
333
350
|
restore_stdio
|
334
351
|
raise
|
352
|
+
rescue SystemExit => _err
|
353
|
+
# This happens if the CLI calls exit, but the test runner was not
|
354
|
+
# expecting it to exit (because otherwise the test runner would
|
355
|
+
# have called this method with wont_run: true). So long as our
|
356
|
+
# $exited_abnormally works as intended, we have nothing to do.
|
357
|
+
raise
|
335
358
|
end
|
336
359
|
end
|
337
360
|
end
|
@@ -350,6 +373,9 @@ RSpec.shared_context 'CI_CMD' do
|
|
350
373
|
|
351
374
|
WebMock.disable_net_connect! unless allow_net_conn
|
352
375
|
|
376
|
+
HighLine.use_color = true
|
377
|
+
Rainbow.enabled = true
|
378
|
+
|
353
379
|
[strip_color(tmpout.string), strip_color(tmperr.string)]
|
354
380
|
end
|
355
381
|
|
@@ -363,6 +389,15 @@ RSpec.shared_context 'CI_CMD' do
|
|
363
389
|
|
364
390
|
# *** before() and around()
|
365
391
|
|
392
|
+
before(:context) do
|
393
|
+
@timeit_time0 = Time.now
|
394
|
+
end
|
395
|
+
|
396
|
+
after(:context) do
|
397
|
+
elapsed_secs = Time.now - @timeit_time0
|
398
|
+
puts "\n .. elapsed: #{elapsed_secs.round(2)} secs."
|
399
|
+
end
|
400
|
+
|
366
401
|
# Before: Load Config.
|
367
402
|
before(:example) do
|
368
403
|
$cfg = MrMurano::Config.new
|
data/spec/cmd_config_spec.rb
CHANGED
@@ -13,17 +13,15 @@ RSpec.describe 'murano config', :cmd do
|
|
13
13
|
include_context 'CI_CMD'
|
14
14
|
|
15
15
|
it 'Needs a key' do
|
16
|
-
out, err
|
17
|
-
expect(
|
18
|
-
expect(out).to eq("\e[31mNeed a config key\e[0m\n")
|
16
|
+
out, err = murano_command_run('config')
|
17
|
+
expect(out).to eq("Need a config key\n")
|
19
18
|
expect(err).to eq('')
|
20
19
|
end
|
21
20
|
|
22
21
|
it 'Sets a key' do
|
23
|
-
out, err
|
22
|
+
out, err = murano_command_run('config', 'bob', 'build')
|
24
23
|
expect(out).to eq('')
|
25
|
-
expect(err).to eq(
|
26
|
-
expect(status).to eq(0)
|
24
|
+
expect(err).to eq("WARNING: Unknown key ‘tool.bob’ set to ‘build’\n")
|
27
25
|
|
28
26
|
afile = IO.read(File.join(@tmpdir, '.murano/config'))
|
29
27
|
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_tool_bob').read
|
@@ -33,10 +31,9 @@ RSpec.describe 'murano config', :cmd do
|
|
33
31
|
it 'Sets a user key' do
|
34
32
|
user_cfg = File.join(ENV['HOME'], '.murano', 'config')
|
35
33
|
File.unlink(user_cfg) if File.exist? user_cfg
|
36
|
-
out, err
|
37
|
-
expect(status).to eq(0)
|
34
|
+
out, err = murano_command_run('config', 'bob', 'build', '--user')
|
38
35
|
expect(out).to eq('')
|
39
|
-
expect(err).to eq(
|
36
|
+
expect(err).to eq("WARNING: Unknown key ‘tool.bob’ set to ‘build’\n")
|
40
37
|
|
41
38
|
afile = IO.read(user_cfg)
|
42
39
|
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_tool_bob').read
|
@@ -50,10 +47,9 @@ RSpec.describe 'murano config', :cmd do
|
|
50
47
|
File.join(@tmpdir, '.murano', 'config'),
|
51
48
|
verbose: true
|
52
49
|
)
|
53
|
-
out, err
|
54
|
-
expect(status).to eq(0)
|
50
|
+
out, err = murano_command_run('config', '--project', 'doThisTest.bob')
|
55
51
|
expect(out).to eq("build\n")
|
56
|
-
expect(err).to eq(
|
52
|
+
expect(err).to eq("WARNING: Unknown key ‘doThisTest.bob’ set to ‘build’\n")
|
57
53
|
end
|
58
54
|
|
59
55
|
it 'Removes a key' do
|
@@ -64,8 +60,7 @@ RSpec.describe 'murano config', :cmd do
|
|
64
60
|
rcf,
|
65
61
|
verbose: true
|
66
62
|
)
|
67
|
-
out, err
|
68
|
-
expect(status).to eq(0)
|
63
|
+
out, err = murano_command_run('config', '--project', '--unset', 'doThisTest.bob')
|
69
64
|
expect(out).to eq('')
|
70
65
|
expect(err).to eq('')
|
71
66
|
|
data/spec/cmd_content_spec.rb
CHANGED
@@ -15,25 +15,23 @@ RSpec.describe 'murano content', :cmd, :needs_password do
|
|
15
15
|
|
16
16
|
before(:example) do
|
17
17
|
@product_name = rname('contestTest')
|
18
|
-
out, err
|
19
|
-
|
18
|
+
out, err = murano_command_run(
|
19
|
+
'solution create', '--type', 'product', @product_name, '--save',
|
20
20
|
)
|
21
21
|
expect(err).to eq('')
|
22
22
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
23
|
-
expect(status.exitstatus).to eq(0)
|
24
23
|
end
|
25
24
|
|
26
25
|
after(:example) do
|
27
|
-
out, err
|
28
|
-
|
26
|
+
out, err = murano_command_run(
|
27
|
+
'solution delete', '--yes', @product_name,
|
29
28
|
)
|
30
29
|
expect(out).to eq('')
|
31
30
|
expect(err).to eq('')
|
32
|
-
expect(status.exitstatus).to eq(0)
|
33
31
|
end
|
34
32
|
|
35
33
|
it 'life cycle', :club_10s do
|
36
|
-
out, err
|
34
|
+
out, err = murano_command_run('content list')
|
37
35
|
#expect(out.lines).to match(
|
38
36
|
# [
|
39
37
|
# a_string_matching(/^(\+-+){2}\+$/),
|
@@ -44,18 +42,16 @@ RSpec.describe 'murano content', :cmd, :needs_password do
|
|
44
42
|
#)
|
45
43
|
#expect(err).to eq('')
|
46
44
|
expect(out.lines).to match([])
|
47
|
-
expect(err).to eq("
|
48
|
-
expect(status.exitstatus).to eq(0)
|
45
|
+
expect(err).to eq("Did not find any content\n")
|
49
46
|
|
50
47
|
FileUtils.copy(File.join(@testdir, 'spec/fixtures/dumped_config'), 'myFile')
|
51
|
-
out, err
|
52
|
-
|
48
|
+
out, err = murano_command_run(
|
49
|
+
'content upload', 'myFile', '--tags', 'random=junk',
|
53
50
|
)
|
54
51
|
expect(out).to eq('')
|
55
52
|
expect(err).to eq('')
|
56
|
-
expect(status.exitstatus).to eq(0)
|
57
53
|
|
58
|
-
out, err
|
54
|
+
out, err = murano_command_run('content list')
|
59
55
|
expect(err).to eq('')
|
60
56
|
expect(out.lines).to match(
|
61
57
|
[
|
@@ -66,9 +62,8 @@ RSpec.describe 'murano content', :cmd, :needs_password do
|
|
66
62
|
a_string_matching(/^(\+-+){2}\+$/),
|
67
63
|
]
|
68
64
|
)
|
69
|
-
expect(status.exitstatus).to eq(0)
|
70
65
|
|
71
|
-
out, err
|
66
|
+
out, err = murano_command_run('content info', 'myFile')
|
72
67
|
expect(err).to eq('')
|
73
68
|
expect { out = YAML.load(out) }.to_not raise_error
|
74
69
|
expect(out).to match(
|
@@ -80,27 +75,22 @@ RSpec.describe 'murano content', :cmd, :needs_password do
|
|
80
75
|
'random' => 'junk',
|
81
76
|
}
|
82
77
|
)
|
83
|
-
expect(status.exitstatus).to eq(0)
|
84
78
|
|
85
|
-
out, err
|
86
|
-
|
79
|
+
out, err = murano_command_run(
|
80
|
+
'content download', 'myFile', '-o', 'testDown',
|
87
81
|
)
|
88
82
|
expect(out).to eq('')
|
89
83
|
expect(err).to eq('')
|
90
|
-
expect(status.exitstatus).to eq(0)
|
91
84
|
expect(File.exist?('testDown')).to be true
|
92
85
|
dcf = IO.read('myFile')
|
93
86
|
tdf = IO.read('testDown')
|
94
87
|
expect(tdf).to eq(dcf)
|
95
88
|
|
96
|
-
|
97
|
-
capcmd('murano', 'content', 'delete', 'myFile', '-y')
|
98
|
-
)
|
89
|
+
murano_command_run('content delete', 'myFile', '-y')
|
99
90
|
expect(out).to eq('')
|
100
91
|
expect(err).to eq('')
|
101
|
-
expect(status.exitstatus).to eq(0)
|
102
92
|
|
103
|
-
out, err
|
93
|
+
out, err = murano_command_run('content list')
|
104
94
|
#expect(out.lines).to match(
|
105
95
|
# [
|
106
96
|
# a_string_matching(/^(\+-+){2}\+$/),
|
@@ -111,8 +101,7 @@ RSpec.describe 'murano content', :cmd, :needs_password do
|
|
111
101
|
#)
|
112
102
|
#expect(err).to eq('')
|
113
103
|
expect(out.lines).to match([])
|
114
|
-
expect(err).to eq("
|
115
|
-
expect(status.exitstatus).to eq(0)
|
104
|
+
expect(err).to eq("Did not find any content\n")
|
116
105
|
end
|
117
106
|
end
|
118
107
|
|