MuranoCLI 3.2.1.pre.beta.6 → 3.2.1.pre.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +10 -0
- data/MuranoCLI.gemspec +37 -6
- data/Rakefile +38 -11
- data/lib/MrMurano/commands/business.rb +0 -4
- data/lib/MrMurano/version.rb +1 -1
- metadata +2 -251
- data/dockers/Dockerfile.2.2.9 +0 -40
- data/dockers/Dockerfile.2.3.6 +0 -40
- data/dockers/Dockerfile.2.4.3 +0 -40
- data/dockers/Dockerfile.2.5.0 +0 -40
- data/dockers/Dockerfile.GemRelease +0 -49
- data/dockers/Dockerfile.m4 +0 -122
- data/dockers/README.rst +0 -362
- data/dockers/RELEASE.rst +0 -135
- data/dockers/docker-test.sh +0 -163
- data/dockers/gem-release.sh +0 -4
- data/docs/basic_example.rst +0 -436
- data/docs/ci/.trustme.plugin +0 -140
- data/docs/ci/.trustme.sh +0 -516
- data/docs/ci/.trustme.vim +0 -55
- data/docs/completions/murano_completion-bash +0 -4484
- data/docs/demo.md +0 -109
- data/docs/develop.rst +0 -392
- data/docs/release.rst +0 -295
- data/spec/Account-Passwords_spec.rb +0 -245
- data/spec/Account_spec.rb +0 -256
- data/spec/Business_spec.rb +0 -307
- data/spec/ConfigFile_spec.rb +0 -55
- data/spec/ConfigMigrate_spec.rb +0 -108
- data/spec/Config_spec.rb +0 -440
- data/spec/Content_spec.rb +0 -422
- data/spec/GatewayBase_spec.rb +0 -65
- data/spec/GatewayDevice_spec.rb +0 -403
- data/spec/GatewayResource_spec.rb +0 -283
- data/spec/GatewaySettings_spec.rb +0 -130
- data/spec/HttpAuthed_spec.rb +0 -87
- data/spec/Http_spec.rb +0 -220
- data/spec/MakePretties_spec.rb +0 -127
- data/spec/Mock_spec.rb +0 -62
- data/spec/ProjectFile_spec.rb +0 -381
- data/spec/Setting_spec.rb +0 -120
- data/spec/Solution-ServiceConfig_spec.rb +0 -272
- data/spec/Solution-ServiceEventHandler_spec.rb +0 -442
- data/spec/Solution-ServiceModules_spec.rb +0 -562
- data/spec/Solution-UsersRoles_spec.rb +0 -269
- data/spec/Solution_spec.rb +0 -140
- data/spec/SyncRoot_spec.rb +0 -111
- data/spec/SyncUpDown_spec.rb +0 -868
- data/spec/Verbosing_spec.rb +0 -332
- data/spec/Webservice-Cors_spec.rb +0 -225
- data/spec/Webservice-Endpoint_spec.rb +0 -650
- data/spec/Webservice-File_spec.rb +0 -282
- data/spec/Webservice-Setting_spec.rb +0 -105
- data/spec/_workspace.rb +0 -43
- data/spec/cmd_business_spec.rb +0 -64
- data/spec/cmd_common.rb +0 -507
- data/spec/cmd_config_spec.rb +0 -73
- data/spec/cmd_content_spec.rb +0 -109
- data/spec/cmd_cors_spec.rb +0 -54
- data/spec/cmd_device_spec.rb +0 -130
- data/spec/cmd_domain_spec.rb +0 -62
- data/spec/cmd_element_spec.rb +0 -401
- data/spec/cmd_exchange_spec.rb +0 -114
- data/spec/cmd_help_spec.rb +0 -72
- data/spec/cmd_init_spec.rb +0 -475
- data/spec/cmd_keystore_spec.rb +0 -97
- data/spec/cmd_link_spec.rb +0 -105
- data/spec/cmd_logs_spec.rb +0 -162
- data/spec/cmd_password_spec.rb +0 -64
- data/spec/cmd_setting_application_spec.rb +0 -300
- data/spec/cmd_setting_product_spec.rb +0 -246
- data/spec/cmd_status_spec.rb +0 -300
- data/spec/cmd_syncdown_application_spec.rb +0 -128
- data/spec/cmd_syncdown_both_spec.rb +0 -178
- data/spec/cmd_syncdown_unit_spec.rb +0 -861
- data/spec/cmd_syncup_spec.rb +0 -148
- data/spec/cmd_token_spec.rb +0 -53
- data/spec/cmd_usage_spec.rb +0 -79
- data/spec/dry_run_formatter.rb +0 -28
- data/spec/fixtures/.mrmuranorc +0 -9
- data/spec/fixtures/ProjectFiles/invalid.yaml +0 -9
- data/spec/fixtures/ProjectFiles/only_meta.yaml +0 -24
- data/spec/fixtures/ProjectFiles/with_routes.yaml +0 -27
- data/spec/fixtures/SolutionFiles/0.2.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +0 -18
- data/spec/fixtures/SolutionFiles/0.2.json +0 -21
- data/spec/fixtures/SolutionFiles/0.3.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +0 -19
- data/spec/fixtures/SolutionFiles/0.3.json +0 -20
- data/spec/fixtures/SolutionFiles/basic.json +0 -20
- data/spec/fixtures/SolutionFiles/secret.json +0 -6
- data/spec/fixtures/configfile +0 -9
- data/spec/fixtures/dumped_config +0 -57
- data/spec/fixtures/exchange_element/element-show.json +0 -1
- data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +0 -282
- data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +0 -588
- data/spec/fixtures/gateway_resource_files/resources.notyaml +0 -12
- data/spec/fixtures/gateway_resource_files/resources.yaml +0 -13
- data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +0 -13
- data/spec/fixtures/mrmuranorc_deleted_bob +0 -6
- data/spec/fixtures/mrmuranorc_tool_bob +0 -3
- data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +0 -116
- data/spec/fixtures/product_spec_files/example.murano.spec.yaml +0 -14
- data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +0 -21
- data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +0 -16
- data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +0 -11
- data/spec/fixtures/product_spec_files/lightbulb.yaml +0 -21
- data/spec/fixtures/roles-three.yaml +0 -11
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +0 -72
- data/spec/fixtures/snapshots/murano business list as json.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list as table.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list fewer fields.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list only ids.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list output to file.webmock +0 -27
- data/spec/fixtures/snapshots/murano business without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Needs a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Reads a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Removes a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a user key.webmock +0 -9
- data/spec/fixtures/snapshots/murano content life cycle.webmock +0 -144
- data/spec/fixtures/snapshots/murano cors sets CORS.webmock +0 -78
- data/spec/fixtures/snapshots/murano cors show CORS.webmock +0 -64
- data/spec/fixtures/snapshots/murano device activates.webmock +0 -86
- data/spec/fixtures/snapshots/murano device enables a batch.webmock +0 -76
- data/spec/fixtures/snapshots/murano device enables and lists.webmock +0 -78
- data/spec/fixtures/snapshots/murano device writes and reads.webmock +0 -136
- data/spec/fixtures/snapshots/murano domain show domain.webmock +0 -101
- data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano element show as csv.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as default-table.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as json.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table truncate.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table wrap.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as yaml.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +0 -43
- data/spec/fixtures/snapshots/murano element without project usage.webmock +0 -9
- data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +0 -83
- data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander as --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +0 -9
- data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +0 -201
- data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +0 -193
- data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +0 -108
- data/spec/fixtures/snapshots/murano keystore clearAll.webmock +0 -124
- data/spec/fixtures/snapshots/murano keystore deletes.webmock +0 -112
- data/spec/fixtures/snapshots/murano keystore gets.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore infos.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore lists.webmock +0 -96
- data/spec/fixtures/snapshots/murano link with project links and lists.webmock +0 -149
- data/spec/fixtures/snapshots/murano link with project unlinks.webmock +0 -165
- data/spec/fixtures/snapshots/murano link without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +0 -9
- data/spec/fixtures/snapshots/murano password Lists when no file.webmock +0 -9
- data/spec/fixtures/snapshots/murano password deletes a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano password sets a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +0 -64
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +0 -90
- data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +0 -322
- data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +0 -151
- data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +0 -479
- data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +0 -357
- data/spec/fixtures/snapshots/murano token with project list as table.webmock +0 -9
- data/spec/fixtures/snapshots/murano token without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano usage show usage.webmock +0 -93
- data/spec/fixtures/syncable_conflict/services/devdata.lua +0 -18
- data/spec/fixtures/syncable_conflict/services/timers.lua +0 -4
- data/spec/fixtures/syncable_content/assets/icon.png +0 -0
- data/spec/fixtures/syncable_content/assets/index.html +0 -0
- data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
- data/spec/fixtures/syncable_content/modules/table_util.lua +0 -58
- data/spec/fixtures/syncable_content/routes/manyRoutes.lua +0 -11
- data/spec/fixtures/syncable_content/routes/singleRoute.lua +0 -5
- data/spec/fixtures/websocket/README.rst +0 -110
- data/spec/fixtures/websocket/logs_blather.rb +0 -27
- data/spec/fixtures/websocket/logs_faker.rb +0 -153
- data/spec/fixtures/websocket/simple_connection.rb +0 -45
- data/spec/fixtures/websocket/simple_options.rb +0 -77
- data/spec/fixtures/websocket/simple_server.rb +0 -69
- data/spec/fixtures/websocket/wss-echo.rb +0 -48
- data/spec/fixtures/websocket/wss-fake-logs.rb +0 -20
- data/spec/spec_helper.rb +0 -131
- data/spec/variegated_TruthyFalsey_spec.rb +0 -29
- data/spec/webmock_snapshot.rb +0 -296
data/spec/cmd_config_spec.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'fileutils'
|
9
|
-
require 'open3'
|
10
|
-
require 'cmd_common'
|
11
|
-
|
12
|
-
RSpec.describe 'murano config', :cmd do
|
13
|
-
include_context 'CI_CMD'
|
14
|
-
|
15
|
-
it 'Needs a key' do
|
16
|
-
out, err = murano_command_run('config')
|
17
|
-
expect(out).to eq("Need a config key\n")
|
18
|
-
expect(err).to eq('')
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'Sets a key' do
|
22
|
-
out, err = murano_command_run('config', 'bob', 'build')
|
23
|
-
expect(out).to eq('')
|
24
|
-
expect(err).to eq("WARNING: Unknown key ‘tool.bob’ set to ‘build’\n")
|
25
|
-
|
26
|
-
afile = IO.read(File.join(@tmpdir, '.murano/config'))
|
27
|
-
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_tool_bob').read
|
28
|
-
expect(afile).to eq(bfile)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'Sets a user key' do
|
32
|
-
user_cfg = File.join(ENV['HOME'], '.murano', 'config')
|
33
|
-
File.unlink(user_cfg) if File.exist? user_cfg
|
34
|
-
out, err = murano_command_run('config', 'bob', 'build', '--user')
|
35
|
-
expect(out).to eq('')
|
36
|
-
expect(err).to eq("WARNING: Unknown key ‘tool.bob’ set to ‘build’\n")
|
37
|
-
|
38
|
-
afile = IO.read(user_cfg)
|
39
|
-
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_tool_bob').read
|
40
|
-
expect(afile).to eq(bfile)
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'Reads a key' do
|
44
|
-
FileUtils.mkpath(File.join(@tmpdir, '.murano'))
|
45
|
-
FileUtils.copy_file(
|
46
|
-
(@testdir + 'spec' + 'fixtures' + '.mrmuranorc').to_s,
|
47
|
-
File.join(@tmpdir, '.murano', 'config'),
|
48
|
-
verbose: true
|
49
|
-
)
|
50
|
-
out, err = murano_command_run('config', '--project', 'doThisTest.bob')
|
51
|
-
expect(out).to eq("build\n")
|
52
|
-
expect(err).to eq("WARNING: Unknown key ‘doThisTest.bob’ set to ‘build’\n")
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'Removes a key' do
|
56
|
-
FileUtils.mkpath(File.join(@tmpdir, '.murano'))
|
57
|
-
rcf = File.join(@tmpdir, '.murano', 'config')
|
58
|
-
FileUtils.copy_file(
|
59
|
-
(@testdir + 'spec' + 'fixtures' + '.mrmuranorc').to_s,
|
60
|
-
rcf,
|
61
|
-
verbose: true
|
62
|
-
)
|
63
|
-
out, err = murano_command_run('config', '--project', '--unset', 'doThisTest.bob')
|
64
|
-
expect(out).to eq('')
|
65
|
-
expect(err).to eq('')
|
66
|
-
|
67
|
-
afile = IO.read(rcf)
|
68
|
-
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_deleted_bob').read
|
69
|
-
expect(afile).to eq(bfile)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# vim: set ai et sw=2 ts=2 :
|
data/spec/cmd_content_spec.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'fileutils'
|
9
|
-
require 'open3'
|
10
|
-
require 'yaml'
|
11
|
-
require 'cmd_common'
|
12
|
-
|
13
|
-
RSpec.describe 'murano content', :cmd, :needs_password do
|
14
|
-
include_context 'CI_CMD'
|
15
|
-
|
16
|
-
before(:example) do
|
17
|
-
@product_name = @snapshotter.resolve_var(
|
18
|
-
'product.name', rname('contestTest')
|
19
|
-
)
|
20
|
-
out, err = murano_command_run(
|
21
|
-
'solution create', '--type', 'product', @product_name, '--save',
|
22
|
-
)
|
23
|
-
expect(err).to eq('')
|
24
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
25
|
-
end
|
26
|
-
|
27
|
-
after(:example) do
|
28
|
-
out, err = murano_command_run(
|
29
|
-
'solution delete', '--yes', @product_name,
|
30
|
-
)
|
31
|
-
expect(out).to eq('')
|
32
|
-
expect(err).to eq('')
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'life cycle', :club_10s do
|
36
|
-
out, err = murano_command_run('content list')
|
37
|
-
#expect(out.lines).to match(
|
38
|
-
# [
|
39
|
-
# a_string_matching(/^(\+-+){2}\+$/),
|
40
|
-
# a_string_matching(/^\| Name\s+\| Size\s+\|$/),
|
41
|
-
# a_string_matching(/^(\+-+){2}\+$/),
|
42
|
-
# a_string_matching(/^(\+-+){2}\+$/),
|
43
|
-
# ]
|
44
|
-
#)
|
45
|
-
#expect(err).to eq('')
|
46
|
-
expect(out.lines).to match([])
|
47
|
-
expect(err).to eq("Did not find any content\n")
|
48
|
-
|
49
|
-
FileUtils.copy(File.join(@testdir, 'spec/fixtures/dumped_config'), 'myFile')
|
50
|
-
out, err = murano_command_run(
|
51
|
-
'content upload', 'myFile', '--tags', 'random=junk',
|
52
|
-
)
|
53
|
-
expect(out).to eq('')
|
54
|
-
expect(err).to eq('')
|
55
|
-
|
56
|
-
out, err = murano_command_run('content list')
|
57
|
-
expect(err).to eq('')
|
58
|
-
expect(out.lines).to match(
|
59
|
-
[
|
60
|
-
a_string_matching(/^(\+-+){2}\+$/),
|
61
|
-
a_string_matching(/^\| Name\s+\| Size\s+\|$/),
|
62
|
-
a_string_matching(/^(\+-+){2}\+$/),
|
63
|
-
a_string_matching(/^\| myFile\s+\| \d+\s+\|$/),
|
64
|
-
a_string_matching(/^(\+-+){2}\+$/),
|
65
|
-
]
|
66
|
-
)
|
67
|
-
|
68
|
-
out, err = murano_command_run('content info', 'myFile')
|
69
|
-
expect(err).to eq('')
|
70
|
-
expect { out = YAML.load(out) }.to_not raise_error
|
71
|
-
expect(out).to match(
|
72
|
-
'type' => a_kind_of(String),
|
73
|
-
'length' => a_kind_of(Integer),
|
74
|
-
'last_modified' => a_kind_of(String),
|
75
|
-
'id' => 'myFile',
|
76
|
-
'tags' => {
|
77
|
-
'random' => 'junk',
|
78
|
-
}
|
79
|
-
)
|
80
|
-
|
81
|
-
out, err = murano_command_run(
|
82
|
-
'content download', 'myFile', '-o', 'testDown',
|
83
|
-
)
|
84
|
-
expect(out).to eq('')
|
85
|
-
expect(err).to eq('')
|
86
|
-
expect(File.exist?('testDown')).to be true
|
87
|
-
dcf = IO.read('myFile')
|
88
|
-
tdf = IO.read('testDown')
|
89
|
-
expect(tdf).to eq(dcf)
|
90
|
-
|
91
|
-
murano_command_run('content delete', 'myFile', '-y')
|
92
|
-
expect(out).to eq('')
|
93
|
-
expect(err).to eq('')
|
94
|
-
|
95
|
-
out, err = murano_command_run('content list')
|
96
|
-
#expect(out.lines).to match(
|
97
|
-
# [
|
98
|
-
# a_string_matching(/^(\+-+){2}\+$/),
|
99
|
-
# a_string_matching(/^\| Name\s+\| Size\s+\|$/),
|
100
|
-
# a_string_matching(/^(\+-+){2}\+$/),
|
101
|
-
# a_string_matching(/^(\+-+){2}\+$/),
|
102
|
-
# ]
|
103
|
-
#)
|
104
|
-
#expect(err).to eq('')
|
105
|
-
expect(out.lines).to match([])
|
106
|
-
expect(err).to eq("Did not find any content\n")
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
data/spec/cmd_cors_spec.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'fileutils'
|
9
|
-
require 'open3'
|
10
|
-
require 'json'
|
11
|
-
require 'cmd_common'
|
12
|
-
|
13
|
-
RSpec.describe 'murano cors', :cmd, :needs_password do
|
14
|
-
include_context 'CI_CMD'
|
15
|
-
|
16
|
-
before(:example) do
|
17
|
-
@application_name = @snapshotter.resolve_var(
|
18
|
-
'application.name', rname('corstest')
|
19
|
-
)
|
20
|
-
out, err = murano_command_run(
|
21
|
-
'solution create', '--type', 'application', @application_name, '--save',
|
22
|
-
)
|
23
|
-
expect(err).to eq('')
|
24
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
25
|
-
end
|
26
|
-
|
27
|
-
after(:example) do
|
28
|
-
out, err = murano_command_run('solution delete', @application_name, '-y')
|
29
|
-
expect(out).to eq('')
|
30
|
-
expect(err).to eq('')
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'show CORS' do
|
34
|
-
out, err = murano_command_run('cors', '-c', 'outformat=json')
|
35
|
-
expect { JSON.parse(out) }.to_not raise_error
|
36
|
-
expect(err).to eq('')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'sets CORS' do
|
40
|
-
File.open('cors.yaml', 'wb') do |io|
|
41
|
-
io << { origin: ['http://localhost:*'] }.to_json
|
42
|
-
end
|
43
|
-
|
44
|
-
out, err = murano_command_run('cors set', 'cors.yaml')
|
45
|
-
expect(out).to eq('')
|
46
|
-
expect(err).to eq('')
|
47
|
-
|
48
|
-
out, err = murano_command_run('cors', '-c', 'outformat=json')
|
49
|
-
expect { out = JSON.parse(out) }.to_not raise_error
|
50
|
-
expect(out).to include('origin' => contain_exactly('http://localhost:*'))
|
51
|
-
expect(err).to eq('')
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
data/spec/cmd_device_spec.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'fileutils'
|
9
|
-
require 'open3'
|
10
|
-
require 'cmd_common'
|
11
|
-
|
12
|
-
RSpec.describe 'murano device', :cmd, :needs_password do
|
13
|
-
include_context 'CI_CMD'
|
14
|
-
|
15
|
-
before(:example) do
|
16
|
-
@product_name = @snapshotter.resolve_var(
|
17
|
-
'product.name', rname('deviceTest')
|
18
|
-
)
|
19
|
-
out, err = murano_command_run(
|
20
|
-
'solution create', '--type', 'product', @product_name, '--save',
|
21
|
-
)
|
22
|
-
expect(err).to eq('')
|
23
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
24
|
-
end
|
25
|
-
|
26
|
-
after(:example) do
|
27
|
-
out, err = murano_command_run(
|
28
|
-
'solution delete', '-y', @product_name,
|
29
|
-
)
|
30
|
-
expect(out).to eq('')
|
31
|
-
expect(err).to eq('')
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'enables and lists' do
|
35
|
-
out, err = murano_command_run('product device enable', '12345')
|
36
|
-
expect(out).to eq('')
|
37
|
-
expect(err).to eq('')
|
38
|
-
|
39
|
-
out, err = murano_command_run('product device list')
|
40
|
-
expect(err).to eq('')
|
41
|
-
olines = out.lines
|
42
|
-
expect(olines[0]).to match(/^(\+-+){3}\+$/)
|
43
|
-
expect(olines[1]).to match(/^\| Identifier\s+\| Status\s+\| Online\s+\|$/)
|
44
|
-
expect(olines[2]).to match(/^(\+-+){3}\+$/)
|
45
|
-
expect(olines[3]).to match(/^\| 12345\s+\| whitelisted\s+\| false\s+\|$/)
|
46
|
-
expect(olines[4]).to match(/^(\+-+){3}\+$/)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'enables a batch' do
|
50
|
-
File.open('ids.csv', 'w') do |io|
|
51
|
-
io << "ID\n"
|
52
|
-
io << "1234\n"
|
53
|
-
io << "1235\n"
|
54
|
-
io << "1236\n"
|
55
|
-
end
|
56
|
-
|
57
|
-
out, err = murano_command_run('product device enable', '--file', 'ids.csv')
|
58
|
-
expect(out).to eq('')
|
59
|
-
expect(err).to eq('')
|
60
|
-
|
61
|
-
out, err = murano_command_run('product device list')
|
62
|
-
olines = out.lines
|
63
|
-
expect(olines[0]).to match(/^(\+-+){3}\+$/)
|
64
|
-
expect(olines[1]).to match(/^\| Identifier\s+\| Status\s+\| Online\s+\|$/)
|
65
|
-
expect(olines[2]).to match(/^(\+-+){3}\+$/)
|
66
|
-
expect(olines[3]).to match(/^\| 1234\s+\| whitelisted\s+\| false\s+\|$/)
|
67
|
-
expect(olines[4]).to match(/^\| 1235\s+\| whitelisted\s+\| false\s+\|$/)
|
68
|
-
expect(olines[5]).to match(/^\| 1236\s+\| whitelisted\s+\| false\s+\|$/)
|
69
|
-
expect(olines[6]).to match(/^(\+-+){3}\+$/)
|
70
|
-
expect(err).to eq('')
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'activates' do
|
74
|
-
out, err = murano_command_run('product device enable', '12345')
|
75
|
-
expect(out).to eq('')
|
76
|
-
expect(err).to eq('')
|
77
|
-
|
78
|
-
out, err = murano_command_run('product device activate', '12345')
|
79
|
-
expect(out.chomp).to match(/^[{}a-zA-Z0-9]{40}$/)
|
80
|
-
expect(err).to eq('')
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'writes and reads', :club_10s do
|
84
|
-
FileUtils.mkpath('specs')
|
85
|
-
FileUtils.copy(
|
86
|
-
File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'),
|
87
|
-
'specs/resources.yaml',
|
88
|
-
)
|
89
|
-
|
90
|
-
out, err = murano_command_run('syncup', '--resources')
|
91
|
-
expect(out).to eq(
|
92
|
-
"Adding item state\n" \
|
93
|
-
"Adding item temperature\n" \
|
94
|
-
"Adding item uptime\n" \
|
95
|
-
"Adding item humidity\n" \
|
96
|
-
"Updating remote product resources\n"
|
97
|
-
)
|
98
|
-
expect(err).to eq('')
|
99
|
-
|
100
|
-
out, err = murano_command_run('product device enable', '12345')
|
101
|
-
expect(out).to eq('')
|
102
|
-
expect(err).to eq('')
|
103
|
-
|
104
|
-
out, err = murano_command_run('product device activate', '12345')
|
105
|
-
# 2017-06-01: This used to return hex, e.g., /^\h{40}$/, but now returns
|
106
|
-
# a-zA-Z0-9 (but not \w, which also includes underscore).
|
107
|
-
# 2018-07-18: (lb): Now I'm also seeing curly braces. It might help-
|
108
|
-
# ful to see the spec. on exactly what the acceptable format is...
|
109
|
-
expect(out.chomp).to match(/^[{}a-zA-Z0-9]{40}$/)
|
110
|
-
expect(err).to eq('')
|
111
|
-
|
112
|
-
out, err = murano_command_run('product device write', '12345', 'state=42')
|
113
|
-
expect(out).to eq('')
|
114
|
-
expect(err).to eq('')
|
115
|
-
|
116
|
-
out, err = murano_command_run('product device read', '12345', 'state')
|
117
|
-
#expect(out.strip).to eq('42')
|
118
|
-
expect(err).to eq('')
|
119
|
-
expect(out.lines).to match_array(
|
120
|
-
[
|
121
|
-
/^(\+-+){4}\+$/,
|
122
|
-
/^\| Alias\s+\| Reported\s+\| Set\s+\| Timestamp\s+\|$/,
|
123
|
-
/^(\+-+){4}\+$/,
|
124
|
-
/^\| state\s+\| \s+\| 42\s+\| \d+\s+\|$/,
|
125
|
-
/^(\+-+){4}\+$/,
|
126
|
-
]
|
127
|
-
)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
data/spec/cmd_domain_spec.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'fileutils'
|
9
|
-
require 'open3'
|
10
|
-
require 'cmd_common'
|
11
|
-
|
12
|
-
RSpec.describe 'murano domain', :cmd, :needs_password do
|
13
|
-
include_context 'CI_CMD'
|
14
|
-
|
15
|
-
before(:example) do
|
16
|
-
@product_name = @snapshotter.resolve_var(
|
17
|
-
'product.name', rname('domainTest')
|
18
|
-
)
|
19
|
-
out, err = murano_command_run(
|
20
|
-
'solution create', '--type', 'product', @product_name, '--save',
|
21
|
-
)
|
22
|
-
expect(err).to eq('')
|
23
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
24
|
-
|
25
|
-
@application_name = @snapshotter.resolve_var(
|
26
|
-
'application.name', rname('domainTest')
|
27
|
-
)
|
28
|
-
out, err = murano_command_run(
|
29
|
-
'solution create', '--type', 'application', @application_name, '--save',
|
30
|
-
)
|
31
|
-
expect(err).to eq('')
|
32
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
33
|
-
end
|
34
|
-
|
35
|
-
after(:example) do
|
36
|
-
out, err = murano_command_run('product delete', @product_name, '-y')
|
37
|
-
expect(out).to eq('')
|
38
|
-
expect(err).to eq('')
|
39
|
-
|
40
|
-
out, err = murano_command_run('application delete', @application_name, '--yes')
|
41
|
-
expect(out).to eq('')
|
42
|
-
expect(err).to eq('')
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'show domain', :club_20s, :club_10s do
|
46
|
-
out, err = murano_command_run('domain')
|
47
|
-
# 2017-05-31: Previously, the project could be named whatever and
|
48
|
-
# the URI would start with the same.
|
49
|
-
# expect(out.chomp).to start_with("#{@product_name.downcase}.apps.exosite").and end_with('.io')
|
50
|
-
# Now, it's: <ID>.m2.exosite.io, where ID is of the form, 'j41fj45hhk82so0os'
|
51
|
-
# Is there an expected length? [lb] has seen {16,17}
|
52
|
-
#expect(out.split('.', 2)[0]).to match(/^[a-zA-Z0-9]{16,17}$/)
|
53
|
-
#expect(out.chomp).to end_with('m2.exosite.io')
|
54
|
-
out.lines.each do |line|
|
55
|
-
expect(line).to match(
|
56
|
-
%r{^(Product|Application): domain[Tt]est[a-z0-9]+ <[a-z0-9]+> https://[.\-a-z0-9]+$}
|
57
|
-
)
|
58
|
-
end
|
59
|
-
expect(err).to eq('')
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
data/spec/cmd_element_spec.rb
DELETED
@@ -1,401 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
# (lb): 2018-05-01: Whoa. Coverage at 303 of 306 lines! 99.02%!!
|
9
|
-
|
10
|
-
require 'fileutils'
|
11
|
-
require 'json'
|
12
|
-
require 'open3'
|
13
|
-
require 'pathname'
|
14
|
-
require 'tty-editor'
|
15
|
-
require 'yaml'
|
16
|
-
|
17
|
-
require 'cmd_common'
|
18
|
-
require 'MrMurano/Config'
|
19
|
-
|
20
|
-
RSpec.describe 'murano element', :cmd, :needs_password do
|
21
|
-
include_context 'CI_CMD'
|
22
|
-
|
23
|
-
context 'without project' do
|
24
|
-
it 'usage' do
|
25
|
-
cmd_verify_help('element')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def expect_exchange_element_table(stdout, stderr, num_cols: nil)
|
30
|
-
expect(stderr).to eq('')
|
31
|
-
lines = stdout.lines
|
32
|
-
# FIXME/2018-04-30: Is this too much detail??
|
33
|
-
# What about running test once, dumping output to file,
|
34
|
-
# and expecting same output next time?
|
35
|
-
# Outline of table. n columns. '+-----+-----+---...----+\n'
|
36
|
-
expect(lines[0]).to match(/^(\+-+){#{num_cols}}\+$/)
|
37
|
-
# Header. "... key | value ..."
|
38
|
-
expect(lines[1]).to match(/^\| key \+| value \+|$/)
|
39
|
-
# Separator.
|
40
|
-
expect(lines[2]).to match(/^(\+-+){#{num_cols}}\+$/)
|
41
|
-
# Content. Starts with nested.hash.key.
|
42
|
-
(3..(lines.length - 2)).to_a.each do |line|
|
43
|
-
expect(lines[line]).to match(/^\| [\.0-9a-zA-Z]* +\| /)
|
44
|
-
end
|
45
|
-
expect(lines[-1]).to match(/^(\+-+){#{num_cols}}\+$/)
|
46
|
-
end
|
47
|
-
|
48
|
-
context 'show' do
|
49
|
-
it '--help' do
|
50
|
-
stdout, stderr = murano_command_wont_parse('element show', '--help')
|
51
|
-
expect(stdout).to a_string_starting_with('Usage:')
|
52
|
-
expect(stderr).to eq('')
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'using ambiguous name' do
|
56
|
-
# MEH/2018-04-30: This test is dependent on the platform having
|
57
|
-
# more than one element with the term 'IoT' in its name!
|
58
|
-
# 59bc24836b12c505c98c5a51: ‘Twilio SMS Service’
|
59
|
-
# 5adedb7cdcd2dd1d04082fba: ‘Public application for the twilio’
|
60
|
-
#
|
61
|
-
# FIXME/2018-04-30: Make test-specific elements for this test!
|
62
|
-
stdout, stderr = murano_command_exits('element show', 'twilio')
|
63
|
-
expect(stdout).to eq('')
|
64
|
-
expect(stderr).to a_string_starting_with(
|
65
|
-
'Please be more specific: More than one matching element was found:'
|
66
|
-
)
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'as default-table' do
|
70
|
-
# FIXME/2018-04-30: Make test-specific elements for this test!
|
71
|
-
stdout, stderr = murano_command_run('element show', 'Security as a Culture')
|
72
|
-
expect_exchange_element_table(stdout, stderr, num_cols: 2)
|
73
|
-
expect(stderr).to eq('')
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'as table wrap' do
|
77
|
-
# FIXME/2018-04-30: Make test-specific elements for this test!
|
78
|
-
stdout, stderr = murano_command_run('element show', 'Security as a Culture', '--wrap')
|
79
|
-
expect_exchange_element_table(stdout, stderr, num_cols: 2)
|
80
|
-
expect(stderr).to eq('')
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'as table truncate' do
|
84
|
-
# FIXME/2018-04-30: Make test-specific elements for this test!
|
85
|
-
stdout, stderr = murano_command_run('element show', 'Security as a Culture', '--truncate')
|
86
|
-
expect_exchange_element_table(stdout, stderr, num_cols: 2)
|
87
|
-
expect(stderr).to eq('')
|
88
|
-
end
|
89
|
-
|
90
|
-
# (lb): NOTE: This does not add any additional coverage to element.rb:
|
91
|
-
it 'as json' do
|
92
|
-
# FIXME/2018-04-30: Make test-specific elements for this test!
|
93
|
-
stdout, stderr = murano_command_run('element show', '--json', 'Security as a Culture')
|
94
|
-
expect { JSON.parse(stdout) }.to_not raise_error
|
95
|
-
expect(stderr).to eq('')
|
96
|
-
end
|
97
|
-
|
98
|
-
# (lb): NOTE: This does not add any additional coverage to element.rb:
|
99
|
-
it 'as yaml' do
|
100
|
-
# FIXME/2018-04-30: Make test-specific elements for this test!
|
101
|
-
stdout, stderr = murano_command_run('element show', 'Security as a Culture', '--yaml')
|
102
|
-
expect { YAML.parse(stdout) }.to_not raise_error
|
103
|
-
expect(stderr).to eq('')
|
104
|
-
end
|
105
|
-
|
106
|
-
# (lb): This adds 1 line of coverage.
|
107
|
-
it 'as csv' do
|
108
|
-
# FIXME/2018-04-30: Make test-specific elements for this test!
|
109
|
-
stdout, stderr = murano_command_run('element show', 'Security as a Culture', '--csv')
|
110
|
-
expect(stdout).to_not eq('')
|
111
|
-
expect(stderr).to eq('')
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# FIXME/2018-07-12: (lb): Make test acct. with element. 'til then: disabled.
|
116
|
-
context 'edit', :needs_exchange_element do
|
117
|
-
before(:example) do
|
118
|
-
@json_input_file = 'element-show.json'
|
119
|
-
@spec_swagger_20k = 'swagger-mur-6407__20k.yaml'
|
120
|
-
@spec_swagger_10k = 'swagger-mur-6407__10k.yaml'
|
121
|
-
[
|
122
|
-
@json_input_file,
|
123
|
-
@spec_swagger_20k,
|
124
|
-
@spec_swagger_10k,
|
125
|
-
].each do |path|
|
126
|
-
FileUtils.copy(
|
127
|
-
File.join(@testdir, "spec/fixtures/exchange_element/#{path}"), path
|
128
|
-
)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def element_editor_expect_edit_json_full
|
133
|
-
# Mock the $EDITOR session.
|
134
|
-
expect(TTY::Editor).to receive(:open) do |path|
|
135
|
-
edit_json_make_unique_contact(path)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def edit_json_make_unique_contact(path)
|
140
|
-
pname = path.is_a?(Pathname) && path || Pathname.new(path)
|
141
|
-
pname.write pname.read.gsub(
|
142
|
-
/\n "contact": "[a-f0-9]+",\n/,
|
143
|
-
%(\n "contact": "#{rname}",\n)
|
144
|
-
)
|
145
|
-
end
|
146
|
-
|
147
|
-
def edit_specs_yaml_make_unique_contact(path)
|
148
|
-
pname = path.is_a?(Pathname) && path || Pathname.new(path)
|
149
|
-
rname7 = rname[0..6]
|
150
|
-
pname.write pname.read.gsub(
|
151
|
-
/\n name: Exosite Exosite Exosite Exosite\n/,
|
152
|
-
%(\n name: #{rname7} #{rname7} #{rname7} #{rname7}\n)
|
153
|
-
)
|
154
|
-
end
|
155
|
-
|
156
|
-
def element_editor_expect_edit_plain_contact
|
157
|
-
# Mock the $EDITOR session.
|
158
|
-
expect(TTY::Editor).to receive(:open) do |path|
|
159
|
-
pname = path.is_a?(Pathname) && path || Pathname.new(path)
|
160
|
-
pname.write(rname)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
it '--help' do
|
165
|
-
stdout, stderr = murano_command_wont_parse('element edit', '--help')
|
166
|
-
expect(stdout).to a_string_starting_with('Usage:')
|
167
|
-
expect(stderr).to eq('')
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'as static field option' do
|
171
|
-
stdout, stderr = murano_command_run(
|
172
|
-
'element edit', '--contact', rname, 'MUR-6407'
|
173
|
-
)
|
174
|
-
expect(stdout).to eq('')
|
175
|
-
expect(stderr).to eq('')
|
176
|
-
end
|
177
|
-
|
178
|
-
it 'as dynamic field option' do
|
179
|
-
stdout, stderr = murano_command_run(
|
180
|
-
'element edit', '-e', "contact=#{rname}", 'MUR-6407'
|
181
|
-
)
|
182
|
-
expect(stdout).to eq('')
|
183
|
-
expect(stderr).to eq('')
|
184
|
-
end
|
185
|
-
|
186
|
-
it 'as dynamic edit empty string without update' do
|
187
|
-
# I.e., @edit_fields[''] = nil, meaning should bring up editor.
|
188
|
-
# FIXME: Requires (lb)'s fixed commander library.
|
189
|
-
|
190
|
-
# If we don't change the file, Murano CLI will not PUT to BizAPI.
|
191
|
-
expect(TTY::Editor).to receive(:open).once
|
192
|
-
stdout, stderr = murano_command_exits(
|
193
|
-
'element edit', '-e', '', 'MUR-6407'
|
194
|
-
)
|
195
|
-
expect(stdout).to eq('')
|
196
|
-
expect(stderr).to eq("No new field values specified to update.\n")
|
197
|
-
end
|
198
|
-
|
199
|
-
it 'as dynamic edit empty string with update' do
|
200
|
-
element_editor_expect_edit_json_full
|
201
|
-
stdout, stderr = murano_command_run(
|
202
|
-
'element edit', '-e', '', 'MUR-6407'
|
203
|
-
)
|
204
|
-
expect(stdout).to eq('')
|
205
|
-
expect(stderr).to eq('')
|
206
|
-
end
|
207
|
-
|
208
|
-
it 'as dynamic edit no field with update' do
|
209
|
-
element_editor_expect_edit_json_full
|
210
|
-
stdout, stderr = murano_command_run(
|
211
|
-
'element edit', '-e', '--', 'MUR-6407'
|
212
|
-
)
|
213
|
-
expect(stdout).to eq('')
|
214
|
-
expect(stderr).to eq('')
|
215
|
-
end
|
216
|
-
|
217
|
-
it 'as dynamic edit set empty string' do
|
218
|
-
# I.e., @edit_fields[''] = ''
|
219
|
-
stdout, stderr = murano_command_run(
|
220
|
-
#'element edit', '-e', "''=", 'MUR-6407'
|
221
|
-
'element edit', '-e', '=', 'MUR-6407'
|
222
|
-
)
|
223
|
-
expect(stdout).to eq('')
|
224
|
-
expect(stderr).to eq(
|
225
|
-
%(Request Failed: 400: [400] child "type" fails because ["type" is required]\n)
|
226
|
-
)
|
227
|
-
end
|
228
|
-
|
229
|
-
it 'as edit with too many fields specified' do
|
230
|
-
stdout, stderr = murano_command_exits(
|
231
|
-
'element edit', '-e', 'contact', '-e', 'markdown', 'MUR-6407'
|
232
|
-
)
|
233
|
-
expect(stdout).to eq('')
|
234
|
-
expect(stderr).to eq(
|
235
|
-
%(Please specify at most one field without a value.\n)
|
236
|
-
)
|
237
|
-
end
|
238
|
-
|
239
|
-
it 'as edit with no action specified' do
|
240
|
-
stdout, stderr = murano_command_exits(
|
241
|
-
'element edit', 'MUR-6407'
|
242
|
-
)
|
243
|
-
expect(stdout).to eq('')
|
244
|
-
expect(stderr).to eq(
|
245
|
-
%(Please specify one or more -e/--edit options, or an input file.\n)
|
246
|
-
)
|
247
|
-
end
|
248
|
-
|
249
|
-
it 'as edit with input file not found' do
|
250
|
-
bad_path = "/path/to/nowhere/#{rname}.json"
|
251
|
-
stdout, stderr = murano_command_exits(
|
252
|
-
'element edit', 'MUR-6407', bad_path
|
253
|
-
)
|
254
|
-
expect(stdout).to eq('')
|
255
|
-
expect(stderr).to eq(
|
256
|
-
%(Input file not found: #{bad_path}\n)
|
257
|
-
)
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'as edit with input file found and valid' do
|
261
|
-
path = Pathname.new(@json_input_file)
|
262
|
-
path.write path.read.gsub(
|
263
|
-
/,"contact":"[a-f0-9]+",/,
|
264
|
-
%(,"contact":"#{rname}",)
|
265
|
-
)
|
266
|
-
stdout, stderr = murano_command_run(
|
267
|
-
'element edit', 'MUR-6407', @json_input_file
|
268
|
-
)
|
269
|
-
expect(stdout).to eq('')
|
270
|
-
expect(stderr).to eq('')
|
271
|
-
end
|
272
|
-
|
273
|
-
it 'as edit with input file and too many fields specified' do
|
274
|
-
stdout, stderr = murano_command_exits(
|
275
|
-
'element edit', '-e', 'contact', '-e', 'markdown', 'MUR-6407', @spec_swagger_20k
|
276
|
-
)
|
277
|
-
expect(stdout).to eq('')
|
278
|
-
expect(stderr).to eq(
|
279
|
-
%(Please specify at most a single field when specifing an input file.\n)
|
280
|
-
)
|
281
|
-
end
|
282
|
-
|
283
|
-
it 'as edit with input file and value specified' do
|
284
|
-
stdout, stderr = murano_command_exits(
|
285
|
-
'element edit', '-e', 'contact=XYZ', 'MUR-6407', @spec_swagger_20k
|
286
|
-
)
|
287
|
-
expect(stdout).to eq('')
|
288
|
-
expect(stderr).to eq(
|
289
|
-
%(Please do not specify a value when specifing an input file.\n)
|
290
|
-
)
|
291
|
-
end
|
292
|
-
|
293
|
-
it 'as edit with input file that is too large and unrecognized field' do
|
294
|
-
stdout, stderr = murano_command_run(
|
295
|
-
'element edit', '--edit', "spec=@#{@spec_swagger_20k}", 'MUR-6407'
|
296
|
-
)
|
297
|
-
expect(stdout).to eq('')
|
298
|
-
expect(stderr).to eq(
|
299
|
-
%(Request Failed: 400: [400] "spec" is not allowed\n)
|
300
|
-
)
|
301
|
-
end
|
302
|
-
|
303
|
-
it 'as edit with input file that should not be parsed' do
|
304
|
-
stdout, stderr = murano_command_run(
|
305
|
-
'element edit', '--edit', "specs=@#{@spec_swagger_20k}", 'MUR-6407'
|
306
|
-
)
|
307
|
-
expect(stdout).to eq('')
|
308
|
-
expect(stderr).to eq(
|
309
|
-
%(Request Failed: 400: [400] child "specs" fails because ["specs" must be a string]\n)
|
310
|
-
)
|
311
|
-
end
|
312
|
-
|
313
|
-
# FIXME/2018-05-01 00:10: How does Tilstra circumvent 20k limit?
|
314
|
-
it 'as edit with input file that is too large' do
|
315
|
-
stdout, stderr = murano_command_run(
|
316
|
-
'element edit', '--edit', 'specs', '--plain', '--', 'MUR-6407', @spec_swagger_20k
|
317
|
-
)
|
318
|
-
expect(stdout).to eq('')
|
319
|
-
expect(stderr).to eq(
|
320
|
-
%(Request Failed: 400: [400] child "specs" fails because ["specs" length must be less than or equal to 10000 characters long]\n)
|
321
|
-
)
|
322
|
-
end
|
323
|
-
|
324
|
-
it 'as edit with input file that is just right' do
|
325
|
-
edit_specs_yaml_make_unique_contact(@spec_swagger_10k)
|
326
|
-
stdout, stderr = murano_command_run(
|
327
|
-
'element edit', '--edit', 'specs', '--plain', '--', 'MUR-6407', @spec_swagger_10k
|
328
|
-
)
|
329
|
-
expect(stdout).to eq('')
|
330
|
-
expect(stderr).to eq('')
|
331
|
-
|
332
|
-
# Send same file again.
|
333
|
-
stdout, stderr = murano_command_exits(
|
334
|
-
'element edit', '--edit', 'specs', '--plain', '--', 'MUR-6407', @spec_swagger_10k
|
335
|
-
)
|
336
|
-
expect(stdout).to eq('')
|
337
|
-
expect(stderr).to eq("No new field values specified to update.\n")
|
338
|
-
end
|
339
|
-
|
340
|
-
it 'as dynamic edit single field no value uses EDITOR' do
|
341
|
-
element_editor_expect_edit_plain_contact
|
342
|
-
stdout, stderr = murano_command_run(
|
343
|
-
'element edit', '-e', 'contact', '--', 'MUR-6407'
|
344
|
-
)
|
345
|
-
expect(stdout).to eq('')
|
346
|
-
expect(stderr).to eq('')
|
347
|
-
end
|
348
|
-
|
349
|
-
it 'as dynamic edit nested field change value' do
|
350
|
-
stdout, stderr = murano_command_run(
|
351
|
-
'element edit', '-e', "image.detail.color=0x#{rname[0..5]}", 'MUR-6407'
|
352
|
-
)
|
353
|
-
expect(stdout).to eq('')
|
354
|
-
expect(stderr).to eq('')
|
355
|
-
end
|
356
|
-
|
357
|
-
# (lb): Get 2 more lines of coverage.
|
358
|
-
it 'as dynamic edit no field with update from string' do
|
359
|
-
stdout, stderr = murano_command_run(
|
360
|
-
'element edit',
|
361
|
-
'-e',
|
362
|
-
%(={"bizid":"55cop31gs89","access":"private","attachment":{},"contact":"#{rname}","description":"For testing Murano CLI element-edit.\\n\\nTEST2222\\n\\nTEST MORE","image":{"detail":{"color":"#224123","filename":"","url":""},"thumbnail":{"color":"#224655","filename":"xxx","url":""}},"markdown":"AxxxxAA2333BBBCCC\\n","name":"MUR-6407 Test Element","source":{"from":"service","name":"mur6407testelement","url":"https://testtesttest.apps.exosite-dev.io/swagger-mur-6407.yaml"},"specs":"","type":"service","tags":[],"active":true,"elementId":"5ae3600e313d01708c2a6e0f"}),
|
363
|
-
'MUR-6407'
|
364
|
-
)
|
365
|
-
expect(stdout).to eq('')
|
366
|
-
expect(stderr).to eq('')
|
367
|
-
end
|
368
|
-
|
369
|
-
# (lb): Get 2 more lines of coverage.
|
370
|
-
it 'as dynamic edit no field with update from string not valid Hash' do
|
371
|
-
stdout, stderr = murano_command_exits(
|
372
|
-
'element edit', '-e', %(={), 'MUR-6407'
|
373
|
-
)
|
374
|
-
expect(stdout).to eq('')
|
375
|
-
expect(stderr).to eq %(The document object is not a Hash: {\n765: unexpected token at '{'\n)
|
376
|
-
end
|
377
|
-
|
378
|
-
# (lb): No additional coverage, other than integration.
|
379
|
-
it 'as dynamic edit no field with update from string fields not allowed' do
|
380
|
-
stdout, stderr = murano_command_run(
|
381
|
-
'element edit',
|
382
|
-
'-e',
|
383
|
-
%(={"tiers":[],"bizid":"55cop31gs89","access":"private","attachment":{},"contact":"#{rname}","description":"For testing Murano CLI element-edit.\\n\\nTEST2222\\n\\nTEST MORE","image":{"detail":{"color":"#224123","filename":"","url":""},"thumbnail":{"color":"#224655","filename":"xxx","url":""}},"markdown":"AxxxxAA2333BBBCCC\\n","name":"MUR-6407 Test Element","source":{"from":"service","name":"mur6407testelement","url":"https://testtesttest.apps.exosite-dev.io/swagger-mur-6407.yaml"},"specs":"","type":"service","tags":[],"active":true,"approval":"approved","elementId":"5ae3600e313d01708c2a6e0f"}),
|
384
|
-
'MUR-6407'
|
385
|
-
)
|
386
|
-
expect(stdout).to eq('')
|
387
|
-
expect(stderr).to eq %(Request Failed: 400: [400] "tiers" is not allowed. "approval" is not allowed\n)
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
context 'edit unknown' do
|
392
|
-
it 'as unknown element' do
|
393
|
-
stdout, stderr = murano_command_exits(
|
394
|
-
'element edit', '-e', '', 'BLAH-BLAH-BLAH-NO-NAME-MATCH'
|
395
|
-
)
|
396
|
-
expect(stdout).to eq('')
|
397
|
-
expect(stderr).to eq %(No matching element was found.\n)
|
398
|
-
end
|
399
|
-
end
|
400
|
-
end
|
401
|
-
|