MuranoCLI 3.2.1.pre.beta.4 → 3.2.1.pre.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/Gemfile +4 -3
- data/HISTORY.md +826 -0
- data/Rakefile +415 -47
- data/docs/release.rst +275 -0
- data/lib/MrMurano/Account.rb +46 -47
- data/lib/MrMurano/AccountBase.rb +1 -0
- data/lib/MrMurano/Business.rb +183 -44
- data/lib/MrMurano/Config.rb +1 -0
- data/lib/MrMurano/Exchange.rb +3 -4
- data/lib/MrMurano/Solution-Services.rb +25 -7
- data/lib/MrMurano/Webservice-File.rb +5 -7
- data/lib/MrMurano/commands/business.rb +231 -24
- data/lib/MrMurano/commands/child.rb +3 -3
- data/lib/MrMurano/commands/element.rb +1 -0
- data/lib/MrMurano/commands/settings.rb +7 -0
- data/lib/MrMurano/http.rb +1 -3
- data/lib/MrMurano/progress.rb +12 -2
- data/lib/MrMurano/verbosing.rb +7 -7
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account_spec.rb +9 -0
- data/spec/ProjectFile_spec.rb +7 -9
- data/spec/Webservice-File_spec.rb +2 -1
- data/spec/cmd_business_spec.rb +1 -1
- data/spec/cmd_common.rb +75 -30
- data/spec/cmd_content_spec.rb +3 -1
- data/spec/cmd_cors_spec.rb +3 -1
- data/spec/cmd_device_spec.rb +7 -5
- data/spec/cmd_domain_spec.rb +6 -2
- data/spec/cmd_help_spec.rb +13 -6
- data/spec/cmd_init_spec.rb +19 -10
- data/spec/cmd_keystore_spec.rb +3 -1
- data/spec/cmd_link_spec.rb +5 -5
- data/spec/cmd_setting_application_spec.rb +13 -16
- data/spec/cmd_setting_product_spec.rb +14 -14
- data/spec/cmd_status_spec.rb +6 -2
- data/spec/cmd_syncdown_application_spec.rb +3 -1
- data/spec/cmd_syncdown_both_spec.rb +6 -2
- data/spec/cmd_syncdown_unit_spec.rb +3 -0
- data/spec/cmd_syncup_spec.rb +8 -4
- data/spec/cmd_usage_spec.rb +10 -2
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +72 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +98 -0
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +72 -0
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +72 -0
- data/spec/fixtures/snapshots/murano business list as json.webmock +27 -0
- data/spec/fixtures/snapshots/murano business list as table.webmock +27 -0
- data/spec/fixtures/snapshots/murano business list fewer fields.webmock +27 -0
- data/spec/fixtures/snapshots/murano business list only ids.webmock +27 -0
- data/spec/fixtures/snapshots/murano business list output to file.webmock +27 -0
- data/spec/fixtures/snapshots/murano business without project help.webmock +9 -0
- data/spec/fixtures/snapshots/murano config Needs a key.webmock +9 -0
- data/spec/fixtures/snapshots/murano config Reads a key.webmock +9 -0
- data/spec/fixtures/snapshots/murano config Removes a key.webmock +9 -0
- data/spec/fixtures/snapshots/murano config Sets a key.webmock +9 -0
- data/spec/fixtures/snapshots/murano config Sets a user key.webmock +9 -0
- data/spec/fixtures/snapshots/murano content life cycle.webmock +144 -0
- data/spec/fixtures/snapshots/murano cors sets CORS.webmock +78 -0
- data/spec/fixtures/snapshots/murano cors show CORS.webmock +64 -0
- data/spec/fixtures/snapshots/murano device activates.webmock +86 -0
- data/spec/fixtures/snapshots/murano device enables a batch.webmock +76 -0
- data/spec/fixtures/snapshots/murano device enables and lists.webmock +78 -0
- data/spec/fixtures/snapshots/murano device writes and reads.webmock +136 -0
- data/spec/fixtures/snapshots/murano domain show domain.webmock +101 -0
- data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +43 -0
- data/spec/fixtures/snapshots/murano element show --help.webmock +9 -0
- data/spec/fixtures/snapshots/murano element show as csv.webmock +43 -0
- data/spec/fixtures/snapshots/murano element show as default-table.webmock +43 -0
- data/spec/fixtures/snapshots/murano element show as json.webmock +43 -0
- data/spec/fixtures/snapshots/murano element show as table truncate.webmock +43 -0
- data/spec/fixtures/snapshots/murano element show as table wrap.webmock +43 -0
- data/spec/fixtures/snapshots/murano element show as yaml.webmock +43 -0
- data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +43 -0
- data/spec/fixtures/snapshots/murano element without project usage.webmock +9 -0
- data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +59 -0
- data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +59 -0
- data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +59 -0
- data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +59 -0
- data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +59 -0
- data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +83 -0
- data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +59 -0
- data/spec/fixtures/snapshots/murano exchange without project help.webmock +9 -0
- data/spec/fixtures/snapshots/murano help using commander as --help.webmock +9 -0
- data/spec/fixtures/snapshots/murano help using commander no args.webmock +9 -0
- data/spec/fixtures/snapshots/murano help using subshell no args.webmock +9 -0
- data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +9 -0
- data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +9 -0
- data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +201 -0
- data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +193 -0
- data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +213 -0
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +213 -0
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +213 -0
- data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +213 -0
- data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +108 -0
- data/spec/fixtures/snapshots/murano keystore clearAll.webmock +124 -0
- data/spec/fixtures/snapshots/murano keystore deletes.webmock +112 -0
- data/spec/fixtures/snapshots/murano keystore gets.webmock +96 -0
- data/spec/fixtures/snapshots/murano keystore infos.webmock +96 -0
- data/spec/fixtures/snapshots/murano keystore lists.webmock +96 -0
- data/spec/fixtures/snapshots/murano link with project links and lists.webmock +149 -0
- data/spec/fixtures/snapshots/murano link with project unlinks.webmock +165 -0
- data/spec/fixtures/snapshots/murano link without project help.webmock +9 -0
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +27 -0
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +27 -0
- data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +9 -0
- data/spec/fixtures/snapshots/murano password Lists when no file.webmock +9 -0
- data/spec/fixtures/snapshots/murano password deletes a password.webmock +9 -0
- data/spec/fixtures/snapshots/murano password sets a password.webmock +9 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +90 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +90 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +64 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +90 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +90 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +90 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +90 -0
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +90 -0
- data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +322 -0
- data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +153 -0
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +153 -0
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +153 -0
- data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +153 -0
- data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +153 -0
- data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +153 -0
- data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +151 -0
- data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +479 -0
- data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +357 -0
- data/spec/fixtures/snapshots/murano token with project list as table.webmock +9 -0
- data/spec/fixtures/snapshots/murano token without project help.webmock +9 -0
- data/spec/fixtures/snapshots/murano usage show usage.webmock +93 -0
- data/spec/spec_helper.rb +9 -3
- data/spec/webmock_snapshot.rb +296 -0
- metadata +133 -2
data/spec/cmd_common.rb
CHANGED
@@ -17,9 +17,12 @@ require 'timeout'
|
|
17
17
|
require 'tmpdir'
|
18
18
|
require 'webmock/rspec'
|
19
19
|
|
20
|
+
require 'MrMurano/progress'
|
20
21
|
require 'MrMurano/Config'
|
21
22
|
require 'MrMurano/HttpAuthed'
|
22
23
|
|
24
|
+
require 'webmock_snapshot'
|
25
|
+
|
23
26
|
# Prevent Commander from registering its at_exit hook.
|
24
27
|
# - Also print warning if spec exits, which rspec doesn't see as wrong.
|
25
28
|
# - Note that this comes before importing Commander.
|
@@ -29,6 +32,7 @@ $catpured_io = false
|
|
29
32
|
|
30
33
|
def capture_stdio
|
31
34
|
return if $catpured_io
|
35
|
+
$murcli_wasin = $stdin # (lb): Could probably just use STDIN and skip this global.
|
32
36
|
$murcli_wasout = $stdout
|
33
37
|
$murcli_waserr = $stderr
|
34
38
|
$murcli_wasterm = $terminal
|
@@ -38,9 +42,11 @@ capture_stdio
|
|
38
42
|
|
39
43
|
def restore_stdio
|
40
44
|
return unless $catpured_io
|
45
|
+
$stdin = $murcli_wasin
|
41
46
|
$stdout = $murcli_wasout
|
42
47
|
$stderr = $murcli_waserr
|
43
48
|
$terminal = $murcli_wasterm
|
49
|
+
$murcli_wasin = nil
|
44
50
|
$murcli_wasout = nil
|
45
51
|
$murcli_waserr = nil
|
46
52
|
$murcli_wasterm = nil
|
@@ -111,8 +117,10 @@ RSpec.shared_context 'CI_CMD' do
|
|
111
117
|
args.push '-c', 'fullerror'
|
112
118
|
# The spinner output would make it hard to write expects().
|
113
119
|
args.push '--no-progress'
|
114
|
-
|
115
|
-
|
120
|
+
|
121
|
+
# FIXME: (lb): Is this necessary? Commenting out for now; will delete later.
|
122
|
+
## Save the token.
|
123
|
+
#args.push '--cache'
|
116
124
|
|
117
125
|
if Gem.win_platform?
|
118
126
|
cmd = args.map do |i|
|
@@ -170,22 +178,21 @@ RSpec.shared_context 'CI_CMD' do
|
|
170
178
|
# *** Utility fcns: Murano Solutions management: create/delete/expunge.
|
171
179
|
|
172
180
|
def murano_solutions_expunge_yes
|
173
|
-
|
174
|
-
# because we don't know if it'll exit or not.
|
175
|
-
out, err, status = Open3.capture3(capcmd('murano', 'solutions', 'expunge', '-y'))
|
181
|
+
out, err = murano_command_safe('solutions expunge', '-y')
|
176
182
|
expect(out).to \
|
177
183
|
eq('').or \
|
178
184
|
eq("No solutions found\n").or \
|
179
185
|
match(/^Deleted [\d]+ solutions?/)
|
180
|
-
expect(strip_color(err)).to eq('').or eq("No solutions found\n")
|
181
|
-
expect(status.exitstatus).to eq(0).or eq(1)
|
186
|
+
expect(MrMurano::Progress.strip_color(err)).to eq('').or eq("No solutions found\n")
|
182
187
|
end
|
183
188
|
|
184
189
|
def project_up(skip_link: false)
|
185
190
|
# Preemptive clean up!
|
186
191
|
murano_solutions_expunge_yes if defined?(PRE_EXPUNGE) && PRE_EXPUNGE
|
187
192
|
|
188
|
-
@proj_name_prod =
|
193
|
+
@proj_name_prod = @snapshotter.resolve_var(
|
194
|
+
'product.name', rname('MurCLITestProd')
|
195
|
+
)
|
189
196
|
# NOTE: Do not use alias, which resolves to base command, but without options.
|
190
197
|
# E.g., use 'solution create', ...; and not 'product create'.
|
191
198
|
out, err = murano_command_run(
|
@@ -194,7 +201,9 @@ RSpec.shared_context 'CI_CMD' do
|
|
194
201
|
expect(err).to eq('')
|
195
202
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
196
203
|
|
197
|
-
@proj_name_appy =
|
204
|
+
@proj_name_appy = @snapshotter.resolve_var(
|
205
|
+
'application.name', rname('MurCLITestAppy')
|
206
|
+
)
|
198
207
|
out, err = murano_command_run(
|
199
208
|
'solution create', '--type', 'application', @proj_name_appy, '--save',
|
200
209
|
)
|
@@ -241,10 +250,6 @@ RSpec.shared_context 'CI_CMD' do
|
|
241
250
|
"#{name.downcase}#{Random.new.rand.hash.abs.to_s(16)}"
|
242
251
|
end
|
243
252
|
|
244
|
-
def strip_color(str)
|
245
|
-
str.gsub(/\e\[[;0-9]+m/, '')
|
246
|
-
end
|
247
|
-
|
248
253
|
def strip_fancy(str)
|
249
254
|
# Windows has a complaint about the fancy quotes if you don't encode!, which is
|
250
255
|
#
|
@@ -279,21 +284,39 @@ RSpec.shared_context 'CI_CMD' do
|
|
279
284
|
murano_command_runner(cmd, *args, wont_run: true)
|
280
285
|
end
|
281
286
|
|
287
|
+
def murano_command_safe(cmd, *args)
|
288
|
+
murano_command_runner(cmd, *args, wont_run: :unknown)
|
289
|
+
end
|
290
|
+
|
282
291
|
def murano_command_wont_parse(cmd, *args)
|
283
292
|
murano_command_runner(cmd, *args, wont_parse: true)
|
284
293
|
end
|
285
294
|
|
286
295
|
def murano_command_runner(
|
287
|
-
cmd, *args, wont_run: false, wont_parse: false, skip_cfg: false
|
296
|
+
cmd, *args, wont_run: false, wont_parse: false, skip_cfg: false, stdin_data: nil
|
288
297
|
)
|
289
|
-
#
|
290
|
-
|
291
|
-
|
298
|
+
# DEVS: If you want to set a breakpoint within a command under test,
|
299
|
+
# you need to break into byebug before stdio is redirected.
|
300
|
+
# Just break, then [c]ontinue, and break again within the test,
|
301
|
+
# and then interactive debugging will work. I.e., uncomment this:
|
302
|
+
#
|
303
|
+
# require 'byebug' ; byebug if true
|
304
|
+
#
|
305
|
+
# Though really you just need to break once:
|
306
|
+
#
|
307
|
+
# require 'byebug' ; byebug if !defined?(@@broken)
|
308
|
+
# @@broken = true
|
292
309
|
|
293
310
|
capture_stdio
|
294
311
|
tmpout = StringIO.new
|
295
312
|
tmperr = StringIO.new
|
296
313
|
|
314
|
+
unless stdin_data.nil?
|
315
|
+
$stdin = StringIO.new
|
316
|
+
$stdin.print(stdin_data)
|
317
|
+
$stdin.rewind
|
318
|
+
end
|
319
|
+
|
297
320
|
# Commander's `say` calls HighLine's $terminal.say, so redirect that, too.
|
298
321
|
hline = HighLine.new($stdin, tmpout)
|
299
322
|
$terminal = hline
|
@@ -340,7 +363,7 @@ RSpec.shared_context 'CI_CMD' do
|
|
340
363
|
else
|
341
364
|
runner.old_parse_global_options
|
342
365
|
runner.remove_global_options runner.options, args
|
343
|
-
if wont_run
|
366
|
+
if wont_run == true
|
344
367
|
expect { the_cmd.run(*args) }.to raise_error(SystemExit)
|
345
368
|
else
|
346
369
|
begin
|
@@ -350,11 +373,23 @@ RSpec.shared_context 'CI_CMD' do
|
|
350
373
|
restore_stdio
|
351
374
|
raise
|
352
375
|
rescue SystemExit => _err
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
376
|
+
if wont_run != :unknown
|
377
|
+
# This happens if the CLI calls exit, but the test runner was not
|
378
|
+
# expecting it to exit (because otherwise the test runner would
|
379
|
+
# have called this method with wont_run: true). So long as our
|
380
|
+
# $exited_abnormally works as intended, we have nothing to do.
|
381
|
+
restore_stdio
|
382
|
+
unless tmpout.string.empty?
|
383
|
+
puts "ERROR: Unexpected `exit`: out: #{tmpout.string}"
|
384
|
+
end
|
385
|
+
unless tmperr.string.empty?
|
386
|
+
puts "ERROR: Unexpected `exit`: err: #{tmperr.string}"
|
387
|
+
end
|
388
|
+
if tmpout.string.empty? && tmperr.string.empty?
|
389
|
+
puts 'ERROR: Unexpected `exit`: but no stdout nor stderr message'
|
390
|
+
end
|
391
|
+
raise
|
392
|
+
end
|
358
393
|
end
|
359
394
|
end
|
360
395
|
end
|
@@ -371,12 +406,13 @@ RSpec.shared_context 'CI_CMD' do
|
|
371
406
|
# $stdout, $stderr = STDOUT, STDERR
|
372
407
|
restore_stdio
|
373
408
|
|
374
|
-
WebMock.disable_net_connect! unless allow_net_conn
|
375
|
-
|
376
409
|
HighLine.use_color = true
|
377
410
|
Rainbow.enabled = true
|
378
411
|
|
379
|
-
[
|
412
|
+
[
|
413
|
+
MrMurano::Progress.strip_color(tmpout.string),
|
414
|
+
MrMurano::Progress.strip_color(tmperr.string),
|
415
|
+
]
|
380
416
|
end
|
381
417
|
|
382
418
|
def cmd_verify_help(cmd_name)
|
@@ -399,13 +435,22 @@ RSpec.shared_context 'CI_CMD' do
|
|
399
435
|
end
|
400
436
|
|
401
437
|
# Before: Load Config.
|
402
|
-
before(:example) do
|
438
|
+
before(:example) do |example|
|
403
439
|
$cfg = MrMurano::Config.new
|
404
440
|
$cfg.load
|
441
|
+
|
442
|
+
# Manage snapshot testing.
|
443
|
+
@snapshotter = MrMurano::Snapshot::WebMock.instance
|
444
|
+
@snapshotter.reset(example)
|
445
|
+
@snapshotter.establish_mocks
|
446
|
+
end
|
447
|
+
|
448
|
+
after(:example) do
|
449
|
+
@snapshotter.terminate_mocks
|
405
450
|
end
|
406
451
|
|
407
452
|
# Around: Make project dir under /tmp.
|
408
|
-
around(:example) do |
|
453
|
+
around(:example) do |example|
|
409
454
|
# Load the byebug library now, before changing directories.
|
410
455
|
# This sets Setting[:histfile]. Within byebug, try `show histfile`.
|
411
456
|
# Make sure this is set now, otherwise, byebug crashes, e.g.,
|
@@ -419,7 +464,7 @@ RSpec.shared_context 'CI_CMD' do
|
|
419
464
|
require 'byebug/settings/histfile'
|
420
465
|
_ignored = ::Byebug::HistfileSetting::DEFAULT
|
421
466
|
|
422
|
-
$exited_abnormally =
|
467
|
+
$exited_abnormally = example.example.to_s
|
423
468
|
|
424
469
|
@testdir = Pathname.new(Dir.pwd).realpath
|
425
470
|
Dir.mktmpdir do |hdir|
|
@@ -448,7 +493,7 @@ RSpec.shared_context 'CI_CMD' do
|
|
448
493
|
mk_symlink
|
449
494
|
# Timeout after 300 secs/5 mins.
|
450
495
|
Timeout.timeout(300) do
|
451
|
-
|
496
|
+
example.run
|
452
497
|
end
|
453
498
|
rm_symlink
|
454
499
|
end
|
data/spec/cmd_content_spec.rb
CHANGED
@@ -14,7 +14,9 @@ RSpec.describe 'murano content', :cmd, :needs_password do
|
|
14
14
|
include_context 'CI_CMD'
|
15
15
|
|
16
16
|
before(:example) do
|
17
|
-
@product_name =
|
17
|
+
@product_name = @snapshotter.resolve_var(
|
18
|
+
'product.name', rname('contestTest')
|
19
|
+
)
|
18
20
|
out, err = murano_command_run(
|
19
21
|
'solution create', '--type', 'product', @product_name, '--save',
|
20
22
|
)
|
data/spec/cmd_cors_spec.rb
CHANGED
@@ -14,7 +14,9 @@ RSpec.describe 'murano cors', :cmd, :needs_password do
|
|
14
14
|
include_context 'CI_CMD'
|
15
15
|
|
16
16
|
before(:example) do
|
17
|
-
@application_name =
|
17
|
+
@application_name = @snapshotter.resolve_var(
|
18
|
+
'application.name', rname('corstest')
|
19
|
+
)
|
18
20
|
out, err = murano_command_run(
|
19
21
|
'solution create', '--type', 'application', @application_name, '--save',
|
20
22
|
)
|
data/spec/cmd_device_spec.rb
CHANGED
@@ -13,7 +13,9 @@ RSpec.describe 'murano device', :cmd, :needs_password do
|
|
13
13
|
include_context 'CI_CMD'
|
14
14
|
|
15
15
|
before(:example) do
|
16
|
-
@product_name =
|
16
|
+
@product_name = @snapshotter.resolve_var(
|
17
|
+
'product.name', rname('deviceTest')
|
18
|
+
)
|
17
19
|
out, err = murano_command_run(
|
18
20
|
'solution create', '--type', 'product', @product_name, '--save',
|
19
21
|
)
|
@@ -87,10 +89,10 @@ RSpec.describe 'murano device', :cmd, :needs_password do
|
|
87
89
|
|
88
90
|
out, err = murano_command_run('syncup', '--resources')
|
89
91
|
expect(out).to eq(
|
90
|
-
"Adding item state\n"
|
91
|
-
"Adding item temperature\n"
|
92
|
-
"Adding item uptime\n"
|
93
|
-
"Adding item humidity\n"
|
92
|
+
"Adding item state\n" \
|
93
|
+
"Adding item temperature\n" \
|
94
|
+
"Adding item uptime\n" \
|
95
|
+
"Adding item humidity\n" \
|
94
96
|
"Updating remote product resources\n"
|
95
97
|
)
|
96
98
|
expect(err).to eq('')
|
data/spec/cmd_domain_spec.rb
CHANGED
@@ -13,14 +13,18 @@ RSpec.describe 'murano domain', :cmd, :needs_password do
|
|
13
13
|
include_context 'CI_CMD'
|
14
14
|
|
15
15
|
before(:example) do
|
16
|
-
@product_name =
|
16
|
+
@product_name = @snapshotter.resolve_var(
|
17
|
+
'product.name', rname('domainTest')
|
18
|
+
)
|
17
19
|
out, err = murano_command_run(
|
18
20
|
'solution create', '--type', 'product', @product_name, '--save',
|
19
21
|
)
|
20
22
|
expect(err).to eq('')
|
21
23
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
22
24
|
|
23
|
-
@application_name =
|
25
|
+
@application_name = @snapshotter.resolve_var(
|
26
|
+
'application.name', rname('domainTest')
|
27
|
+
)
|
24
28
|
out, err = murano_command_run(
|
25
29
|
'solution create', '--type', 'application', @application_name, '--save',
|
26
30
|
)
|
data/spec/cmd_help_spec.rb
CHANGED
@@ -11,6 +11,7 @@ require 'open3'
|
|
11
11
|
require 'highline/import'
|
12
12
|
|
13
13
|
require 'cmd_common'
|
14
|
+
require 'MrMurano/progress'
|
14
15
|
|
15
16
|
RSpec.describe 'murano help', :cmd do
|
16
17
|
include_context 'CI_CMD'
|
@@ -23,7 +24,7 @@ RSpec.describe 'murano help', :cmd do
|
|
23
24
|
expect(status.exitstatus).to eq(0)
|
24
25
|
end
|
25
26
|
|
26
|
-
it '
|
27
|
+
it 'with --help' do
|
27
28
|
out, err, status = Open3.capture3(capcmd('murano', '--help'))
|
28
29
|
expect(err).to eq('')
|
29
30
|
expect(out).to_not eq('')
|
@@ -33,20 +34,26 @@ RSpec.describe 'murano help', :cmd do
|
|
33
34
|
|
34
35
|
context 'using commander' do
|
35
36
|
it 'no args' do
|
36
|
-
#
|
37
|
-
|
37
|
+
# (lb): Note that the bare command is really the `help` command, e.g.,
|
38
|
+
# So this:
|
39
|
+
# out, err, status = Open3.capture3(capcmd('murano'))
|
40
|
+
# Or this:
|
41
|
+
# $ murano
|
42
|
+
# Is the same as this:
|
43
|
+
# out, err = murano_command_run('help')
|
44
|
+
out, err = murano_command_run('help')
|
38
45
|
# The :help command gets processed by optparse, since we did
|
39
46
|
# not call run!, and optparse looks at $0, which is 'rspec'.
|
40
|
-
expect(strip_color(
|
47
|
+
expect(MrMurano::Progress.strip_color(out)).to start_with(
|
41
48
|
" NAME:\n\n #{File.basename $PROGRAM_NAME}\n\n DESCRIPTION:\n\n "
|
42
49
|
)
|
43
|
-
expect(
|
50
|
+
expect(err).to eq('')
|
44
51
|
end
|
45
52
|
|
46
53
|
it 'as --help' do
|
47
54
|
stdout, stderr = murano_command_wont_parse('help', '--help')
|
48
55
|
# See comment above; optparse uses $0, or 'rspec'.
|
49
|
-
expect(strip_color(stdout)).to start_with(
|
56
|
+
expect(MrMurano::Progress.strip_color(stdout)).to start_with(
|
50
57
|
"Usage: #{File.basename $PROGRAM_NAME} [options]\n"
|
51
58
|
)
|
52
59
|
expect(stderr).to eq('')
|
data/spec/cmd_init_spec.rb
CHANGED
@@ -150,14 +150,18 @@ RSpec.describe 'murano init', :cmd do
|
|
150
150
|
before(:example) do
|
151
151
|
murano_solutions_expunge_yes
|
152
152
|
|
153
|
-
@applctn_name =
|
153
|
+
@applctn_name = @snapshotter.resolve_var(
|
154
|
+
'application.name', rname('initEmptyApp')
|
155
|
+
)
|
154
156
|
out, err = murano_command_run(
|
155
157
|
'solution create', '--type', 'application', @applctn_name, '--save',
|
156
158
|
)
|
157
159
|
expect(err).to eq('')
|
158
160
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
159
161
|
|
160
|
-
@product_name =
|
162
|
+
@product_name = @snapshotter.resolve_var(
|
163
|
+
'product.name', rname('initEmptyPrd')
|
164
|
+
)
|
161
165
|
out, err = murano_command_run(
|
162
166
|
'solution create', '--type', 'product', @product_name, '--save',
|
163
167
|
)
|
@@ -209,8 +213,12 @@ RSpec.describe 'murano init', :cmd do
|
|
209
213
|
context 'without', :needs_password do
|
210
214
|
before(:example) do
|
211
215
|
murano_solutions_expunge_yes
|
212
|
-
@applctn_name =
|
213
|
-
|
216
|
+
@applctn_name = @snapshotter.resolve_var(
|
217
|
+
'application.name', rname('initCreatingApp')
|
218
|
+
)
|
219
|
+
@product_name = @snapshotter.resolve_var(
|
220
|
+
'product.name', rname('initCreatingPrd')
|
221
|
+
)
|
214
222
|
end
|
215
223
|
after(:example) do
|
216
224
|
out, err = murano_command_run(
|
@@ -235,9 +243,7 @@ RSpec.describe 'murano init', :cmd do
|
|
235
243
|
#{@applctn_name}
|
236
244
|
#{@product_name}
|
237
245
|
DATA
|
238
|
-
|
239
|
-
# FIXME/2018-07-26: (lb): Use murano_command_run here? What about stdin_date?
|
240
|
-
out, err, status = Open3.capture3(capcmd('murano', 'init'), stdin_data: data)
|
246
|
+
out, err = murano_command_run('init', stdin_data: data)
|
241
247
|
expecting = expected_response_when_ids_found_in_config(
|
242
248
|
self,
|
243
249
|
has_no_solutions: true,
|
@@ -279,7 +285,6 @@ RSpec.describe 'murano init', :cmd do
|
|
279
285
|
# "\n", # 30
|
280
286
|
#])
|
281
287
|
expect(err).to eq('')
|
282
|
-
expect(status.exitstatus).to eq(0)
|
283
288
|
|
284
289
|
expect(File.directory?('.murano')).to be true
|
285
290
|
expect(File.exist?('.murano/config')).to be true
|
@@ -301,14 +306,18 @@ RSpec.describe 'murano init', :cmd do
|
|
301
306
|
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
302
307
|
FileUtils.move('assets', 'files')
|
303
308
|
|
304
|
-
@applctn_name =
|
309
|
+
@applctn_name = @snapshotter.resolve_var(
|
310
|
+
'application.name', rname('initEmptyApp')
|
311
|
+
)
|
305
312
|
out, err = murano_command_run(
|
306
313
|
'solution create', '--type', 'application', @applctn_name, '--save',
|
307
314
|
)
|
308
315
|
expect(err).to eq('')
|
309
316
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
310
317
|
|
311
|
-
@product_name =
|
318
|
+
@product_name = @snapshotter.resolve_var(
|
319
|
+
'product.name', rname('initEmptyPrd')
|
320
|
+
)
|
312
321
|
out, err = murano_command_run(
|
313
322
|
'solution create', '--type', 'product', @product_name, '--save',
|
314
323
|
)
|
data/spec/cmd_keystore_spec.rb
CHANGED
@@ -16,7 +16,9 @@ RSpec.describe 'murano keystore', :cmd, :needs_password do
|
|
16
16
|
before(:example) do
|
17
17
|
murano_solutions_expunge_yes
|
18
18
|
|
19
|
-
@product_name =
|
19
|
+
@product_name = @snapshotter.resolve_var(
|
20
|
+
'product.name', rname('keystoreTest')
|
21
|
+
)
|
20
22
|
out, err = murano_command_run(
|
21
23
|
'solution create', '--type', 'application', @product_name, '--save',
|
22
24
|
)
|
data/spec/cmd_link_spec.rb
CHANGED
@@ -10,6 +10,7 @@ require 'open3'
|
|
10
10
|
|
11
11
|
require 'cmd_common'
|
12
12
|
require 'MrMurano/Config'
|
13
|
+
require 'MrMurano/progress'
|
13
14
|
require 'MrMurano/commands/link'
|
14
15
|
|
15
16
|
RSpec.describe 'murano link', :cmd, :needs_password do
|
@@ -26,11 +27,10 @@ RSpec.describe 'murano link', :cmd, :needs_password do
|
|
26
27
|
context 'subshell vs inline' do
|
27
28
|
context 'using subshell' do
|
28
29
|
it 'will not list' do
|
29
|
-
out, err
|
30
|
-
expect(
|
31
|
-
expecting = %(
|
32
|
-
expect(strip_color(err)).to eq(expecting)
|
33
|
-
expect(status.exitstatus).to eq(1)
|
30
|
+
out, err = murano_command_exits('link list')
|
31
|
+
expect(out).to eq('')
|
32
|
+
expecting = %(No applications found\nNo service links found\n)
|
33
|
+
expect(MrMurano::Progress.strip_color(err)).to eq(expecting)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -17,7 +17,9 @@ RSpec.describe 'murano application setting', :cmd, :needs_password do
|
|
17
17
|
before(:example) do
|
18
18
|
murano_solutions_expunge_yes
|
19
19
|
|
20
|
-
@product_name =
|
20
|
+
@product_name = @snapshotter.resolve_var(
|
21
|
+
'product.name', rname('settingtest')
|
22
|
+
)
|
21
23
|
out, err = murano_command_run(
|
22
24
|
'solution create', '--type', 'application', @product_name, '--save',
|
23
25
|
)
|
@@ -57,9 +59,9 @@ RSpec.describe 'murano application setting', :cmd, :needs_password do
|
|
57
59
|
expect(err).to eq('')
|
58
60
|
end
|
59
61
|
# {'origin'=>true,
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
62
|
+
# 'methods'=>['HEAD', 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
63
|
+
# 'headers'=>['Content-Type', 'Cookie', 'Authorization'],
|
64
|
+
# 'credentials'=>true}
|
63
65
|
|
64
66
|
context 'a bool value' do
|
65
67
|
it 'Yes', :club_10s do
|
@@ -207,13 +209,12 @@ RSpec.describe 'murano application setting', :cmd, :needs_password do
|
|
207
209
|
end
|
208
210
|
|
209
211
|
it 'on STDIN', :club_10s do
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
)
|
212
|
+
out, err = murano_command_run(
|
213
|
+
'setting write', 'Webservice.cors', 'origin', '--bool',
|
214
|
+
stdin_data: 'true',
|
215
|
+
)
|
214
216
|
expect(err).to eq('')
|
215
217
|
expect(out).to eq('')
|
216
|
-
expect(status.exitstatus).to eq(0)
|
217
218
|
|
218
219
|
out, err = murano_command_run(
|
219
220
|
'setting read', 'Webservice.cors', '-c', 'outformat=json',
|
@@ -244,16 +245,12 @@ RSpec.describe 'murano application setting', :cmd, :needs_password do
|
|
244
245
|
end
|
245
246
|
|
246
247
|
it 'a json array blob with STDIN', :club_10s do
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
'murano', 'setting', 'write', 'Webservice.cors', 'headers', '--json',
|
251
|
-
),
|
252
|
-
stdin_data: '["fidget", "forgotten", "tokens"]'
|
248
|
+
out, err = murano_command_run(
|
249
|
+
'setting write', 'Webservice.cors', 'headers', '--json',
|
250
|
+
stdin_data: '["fidget", "forgotten", "tokens"]',
|
253
251
|
)
|
254
252
|
expect(err).to eq('')
|
255
253
|
expect(out).to eq('')
|
256
|
-
expect(status.exitstatus).to eq(0)
|
257
254
|
|
258
255
|
out, err = murano_command_run(
|
259
256
|
'setting read', 'Webservice.cors', '-c', 'outformat=json',
|
@@ -15,7 +15,9 @@ RSpec.describe 'murano product setting', :cmd, :needs_password do
|
|
15
15
|
include_context 'CI_CMD'
|
16
16
|
|
17
17
|
before(:example) do
|
18
|
-
@product_name =
|
18
|
+
@product_name = @snapshotter.resolve_var(
|
19
|
+
'product.name', rname('settingtest')
|
20
|
+
)
|
19
21
|
out, err = murano_command_run(
|
20
22
|
'solution create', '--type', 'product', @product_name, '--save',
|
21
23
|
)
|
@@ -74,13 +76,12 @@ RSpec.describe 'murano product setting', :cmd, :needs_password do
|
|
74
76
|
end
|
75
77
|
|
76
78
|
it 'a forced string value on STDIN', :club_10s do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
)
|
79
|
+
out, err = murano_command_run(
|
80
|
+
'setting write', 'Device2.identity_format', 'prefix', '--string',
|
81
|
+
stdin_data: 'fidget',
|
82
|
+
)
|
81
83
|
expect(err).to eq('')
|
82
84
|
expect(out).to eq('')
|
83
|
-
expect(status.exitstatus).to eq(0)
|
84
85
|
|
85
86
|
out, err = murano_command_run(
|
86
87
|
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
@@ -152,13 +153,12 @@ RSpec.describe 'murano product setting', :cmd, :needs_password do
|
|
152
153
|
end
|
153
154
|
|
154
155
|
it 'on STDIN' do
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
)
|
156
|
+
out, err = murano_command_run(
|
157
|
+
'setting write', 'Device2.identity_format', 'options.length', '--num',
|
158
|
+
stdin_data: '12',
|
159
|
+
)
|
159
160
|
expect(err).to eq('')
|
160
161
|
expect(out).to eq('')
|
161
|
-
expect(status.exitstatus).to eq(0)
|
162
162
|
|
163
163
|
out, err = murano_command_run(
|
164
164
|
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
@@ -238,9 +238,9 @@ RSpec.describe 'murano product setting', :cmd, :needs_password do
|
|
238
238
|
expect(err).to eq('')
|
239
239
|
end
|
240
240
|
# {'origin'=>true,
|
241
|
-
#
|
242
|
-
#
|
243
|
-
#
|
241
|
+
# 'methods'=>['HEAD', 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
242
|
+
# 'headers'=>['Content-Type', 'Cookie', 'Authorization'],
|
243
|
+
# 'credentials'=>true}
|
244
244
|
end
|
245
245
|
end
|
246
246
|
|
data/spec/cmd_status_spec.rb
CHANGED
@@ -28,14 +28,18 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
before(:example) do
|
31
|
-
@product_name =
|
31
|
+
@product_name = @snapshotter.resolve_var(
|
32
|
+
'product.name', rname('statusTest')
|
33
|
+
)
|
32
34
|
out, err = murano_command_run(
|
33
35
|
'solution create', '--type', 'product', @product_name, '--save',
|
34
36
|
)
|
35
37
|
expect(err).to eq('')
|
36
38
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
37
39
|
|
38
|
-
@applctn_name =
|
40
|
+
@applctn_name = @snapshotter.resolve_var(
|
41
|
+
'application.name', rname('statusTest')
|
42
|
+
)
|
39
43
|
out, err = murano_command_run(
|
40
44
|
'solution create', '--type', 'application', @applctn_name, '--save',
|
41
45
|
)
|
@@ -17,7 +17,9 @@ RSpec.describe 'murano single sync', :cmd, :needs_password do
|
|
17
17
|
before(:example) do
|
18
18
|
murano_solutions_expunge_yes
|
19
19
|
|
20
|
-
@applctn_name =
|
20
|
+
@applctn_name = @snapshotter.resolve_var(
|
21
|
+
'application.name', rname('syncdownTestApp')
|
22
|
+
)
|
21
23
|
out, err = murano_command_run(
|
22
24
|
'solution create', '--type', 'application', @applctn_name, '--save',
|
23
25
|
)
|
@@ -15,14 +15,18 @@ RSpec.describe 'murano syncdown', :cmd, :needs_password do
|
|
15
15
|
before(:example) do
|
16
16
|
murano_solutions_expunge_yes
|
17
17
|
|
18
|
-
@product_name =
|
18
|
+
@product_name = @snapshotter.resolve_var(
|
19
|
+
'product.name', rname('syncdownTestPrd')
|
20
|
+
)
|
19
21
|
out, err = murano_command_run(
|
20
22
|
'solution create', '--type', 'product', @product_name, '--save',
|
21
23
|
)
|
22
24
|
expect(err).to eq('')
|
23
25
|
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
24
26
|
|
25
|
-
@applctn_name =
|
27
|
+
@applctn_name = @snapshotter.resolve_var(
|
28
|
+
'application.name', rname('syncdownTestApp')
|
29
|
+
)
|
26
30
|
out, err = murano_command_run(
|
27
31
|
'solution create', '--type', 'application', @applctn_name, '--save',
|
28
32
|
)
|
@@ -5,6 +5,9 @@
|
|
5
5
|
# vim:tw=0:ts=2:sw=2:et:ai
|
6
6
|
# Unauthorized copying of this file is strictly prohibited.
|
7
7
|
|
8
|
+
# FIXME/2018-08-08: (lb): The new webmock_snapshot.rb may
|
9
|
+
# have made this particular file very deletably trash-worthy.
|
10
|
+
|
8
11
|
# NOTE: (lb): This test mimics the sync integration test,
|
9
12
|
# cmd_syncdown_both_spec.rb, implemented as a unit test
|
10
13
|
# (by stubbing all the HTTP calls).
|