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
@@ -1,246 +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 'json'
|
10
|
-
require 'open3'
|
11
|
-
require 'vine'
|
12
|
-
require 'cmd_common'
|
13
|
-
|
14
|
-
RSpec.describe 'murano product setting', :cmd, :needs_password do
|
15
|
-
include_context 'CI_CMD'
|
16
|
-
|
17
|
-
before(:example) do
|
18
|
-
@product_name = @snapshotter.resolve_var(
|
19
|
-
'product.name', rname('settingtest')
|
20
|
-
)
|
21
|
-
out, err = murano_command_run(
|
22
|
-
'solution create', '--type', 'product', @product_name, '--save',
|
23
|
-
)
|
24
|
-
expect(err).to eq('')
|
25
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
26
|
-
end
|
27
|
-
|
28
|
-
after(:example) do
|
29
|
-
out, err = murano_command_run('solution delete', @product_name, '-y')
|
30
|
-
expect(out).to eq('')
|
31
|
-
expect(err).to eq('')
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'Writes (using Device2.identity_format)' do
|
35
|
-
before(:example) do
|
36
|
-
out, err = murano_command_run(
|
37
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
38
|
-
)
|
39
|
-
expect { @json_before = JSON.parse(out) }.to_not raise_error
|
40
|
-
expect(err).to eq('')
|
41
|
-
end
|
42
|
-
# {'prefix'=>'', 'type'=>'opaque', 'options'=>{'casing'=>'mixed', 'length'=>0}}
|
43
|
-
|
44
|
-
it 'a string value', :club_10s do
|
45
|
-
out, err = murano_command_run(
|
46
|
-
'setting write', 'Device2.identity_format', 'prefix', 'fidget',
|
47
|
-
)
|
48
|
-
expect(err).to eq('')
|
49
|
-
expect(out).to eq('')
|
50
|
-
|
51
|
-
out, err = murano_command_run(
|
52
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
53
|
-
)
|
54
|
-
json_after = nil
|
55
|
-
expect { json_after = JSON.parse(out) }.to_not raise_error
|
56
|
-
expect(err).to eq('')
|
57
|
-
@json_before['prefix'] = 'fidget'
|
58
|
-
expect(json_after).to match(@json_before)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'a forced string value', :club_10s do
|
62
|
-
out, err = murano_command_run(
|
63
|
-
'setting write', 'Device2.identity_format', 'prefix', '--string', 'fidget',
|
64
|
-
)
|
65
|
-
expect(err).to eq('')
|
66
|
-
expect(out).to eq('')
|
67
|
-
|
68
|
-
out, err = murano_command_run(
|
69
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
70
|
-
)
|
71
|
-
json_after = nil
|
72
|
-
expect { json_after = JSON.parse(out) }.to_not raise_error
|
73
|
-
expect(err).to eq('')
|
74
|
-
@json_before['prefix'] = 'fidget'
|
75
|
-
expect(json_after).to match(@json_before)
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'a forced string value on STDIN', :club_10s do
|
79
|
-
out, err = murano_command_run(
|
80
|
-
'setting write', 'Device2.identity_format', 'prefix', '--string',
|
81
|
-
stdin_data: 'fidget',
|
82
|
-
)
|
83
|
-
expect(err).to eq('')
|
84
|
-
expect(out).to eq('')
|
85
|
-
|
86
|
-
out, err = murano_command_run(
|
87
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
88
|
-
)
|
89
|
-
json_after = nil
|
90
|
-
expect { json_after = JSON.parse(out) }.to_not raise_error
|
91
|
-
expect(err).to eq('')
|
92
|
-
@json_before['prefix'] = 'fidget'
|
93
|
-
expect(json_after).to match(@json_before)
|
94
|
-
end
|
95
|
-
|
96
|
-
# This may not be testable in integration. (since it does things that get filtered out)
|
97
|
-
it 'all intermediate keys' #do
|
98
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'one.two.three', 'fidget'))
|
99
|
-
# expect(err).to eq('')
|
100
|
-
# expect(out).to eq('')
|
101
|
-
# expect(status.exitstatus).to eq(0)
|
102
|
-
#
|
103
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Device2.identity_format', '-c', 'outformat=json'))
|
104
|
-
# json_after = nil
|
105
|
-
# expect { json_after = JSON.parse(out) }.to_not raise_error
|
106
|
-
# expect(err).to eq('')
|
107
|
-
# expect(status.exitstatus).to eq(0)
|
108
|
-
# @json_before.set('one.two.three', 'figdet')
|
109
|
-
# expect(json_after).to match(@json_before)
|
110
|
-
# end
|
111
|
-
|
112
|
-
context 'a number value' do
|
113
|
-
it 'integer 12', :club_10s do
|
114
|
-
out, err = murano_command_run(
|
115
|
-
'setting write', 'Device2.identity_format', 'options.length', '--num', '12',
|
116
|
-
)
|
117
|
-
expect(err).to eq('')
|
118
|
-
expect(out).to eq('')
|
119
|
-
|
120
|
-
out, err = murano_command_run(
|
121
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
122
|
-
)
|
123
|
-
json_after = nil
|
124
|
-
expect { json_after = JSON.parse(out) }.to_not raise_error
|
125
|
-
expect(err).to eq('')
|
126
|
-
@json_before.set('options.length', 12)
|
127
|
-
expect(json_after).to match(@json_before)
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'float 12.67', :club_10s do
|
131
|
-
out, err = murano_command_run(
|
132
|
-
'setting write', 'Device2.identity_format', 'options.length', '--num', '12.67',
|
133
|
-
)
|
134
|
-
expect(err).to eq('')
|
135
|
-
expect(out).to eq('')
|
136
|
-
|
137
|
-
out, err = murano_command_run(
|
138
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
139
|
-
)
|
140
|
-
json_after = nil
|
141
|
-
expect { json_after = JSON.parse(out) }.to_not raise_error
|
142
|
-
expect(err).to eq('')
|
143
|
-
@json_before.set('options.length', 12.67)
|
144
|
-
expect(json_after).to match(@json_before)
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'fiftyHalf' do
|
148
|
-
out, err = murano_command_exits(
|
149
|
-
'setting write', 'Device2.identity_format', 'options.length', '--num', 'fiftyHalf',
|
150
|
-
)
|
151
|
-
expect(err).to eq("Value \"fiftyHalf\" is not a number\n")
|
152
|
-
expect(out).to eq('')
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'on STDIN' do
|
156
|
-
out, err = murano_command_run(
|
157
|
-
'setting write', 'Device2.identity_format', 'options.length', '--num',
|
158
|
-
stdin_data: '12',
|
159
|
-
)
|
160
|
-
expect(err).to eq('')
|
161
|
-
expect(out).to eq('')
|
162
|
-
|
163
|
-
out, err = murano_command_run(
|
164
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
165
|
-
)
|
166
|
-
json_after = nil
|
167
|
-
expect { json_after = JSON.parse(out) }.to_not raise_error
|
168
|
-
expect(err).to eq('')
|
169
|
-
@json_before.set('options.length', 12)
|
170
|
-
expect(json_after).to match(@json_before)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'a json object blob' #do
|
175
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'type', 'base16'))
|
176
|
-
# expect(err).to eq('')
|
177
|
-
# expect(out).to eq('')
|
178
|
-
# expect(status.exitstatus).to eq(0)
|
179
|
-
#
|
180
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options', '--json', "{'casing': 'lower', 'length': 0}"))
|
181
|
-
# expect(err).to eq('')
|
182
|
-
# expect(out).to eq('')
|
183
|
-
# expect(status.exitstatus).to eq(0)
|
184
|
-
#
|
185
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Device2.identity_format', '-c', 'outformat=json'))
|
186
|
-
# json_after = nil
|
187
|
-
# expect { json_after = JSON.parse(out) }.to_not raise_error
|
188
|
-
# expect(err).to eq('')
|
189
|
-
# expect(status.exitstatus).to eq(0)
|
190
|
-
# @json_before['type'] = 'base16'
|
191
|
-
# @json_before['options'] = {'casing'=>'lower', 'length'=>0}
|
192
|
-
# expect(json_after).to match(@json_before)
|
193
|
-
# end
|
194
|
-
|
195
|
-
it 'a json object blob with stdin'
|
196
|
-
|
197
|
-
# This may not be testable in integration.
|
198
|
-
it 'a dictionary' #do
|
199
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options', '--dict', 'casing', 'lower'))
|
200
|
-
# expect(err).to eq('')
|
201
|
-
# expect(out).to eq('')
|
202
|
-
# expect(status.exitstatus).to eq(0)
|
203
|
-
#
|
204
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Device2.identity_format', '-c', 'outformat=json'))
|
205
|
-
# json_after = nil
|
206
|
-
# expect { json_after = JSON.parse(out) }.to_not raise_error
|
207
|
-
# expect(err).to eq('')
|
208
|
-
# expect(status.exitstatus).to eq(0)
|
209
|
-
# @json_before['options'] = {'casing'=>'lower', 'length'=>0}
|
210
|
-
# expect(json_after).to match(@json_before)
|
211
|
-
# end
|
212
|
-
|
213
|
-
it 'merges into a dictionary', :club_10s do
|
214
|
-
out, err = murano_command_run(
|
215
|
-
'setting write', 'Device2.identity_format', '.', '--dict', '--merge', 'prefix', 'tix', 'type', 'base10',
|
216
|
-
)
|
217
|
-
expect(err).to eq('')
|
218
|
-
expect(out).to eq('')
|
219
|
-
|
220
|
-
out, err = murano_command_run(
|
221
|
-
'setting read', 'Device2.identity_format', '-c', 'outformat=json',
|
222
|
-
)
|
223
|
-
json_after = nil
|
224
|
-
expect { json_after = JSON.parse(out) }.to_not raise_error
|
225
|
-
expect(err).to eq('')
|
226
|
-
@json_before['prefix'] = 'tix'
|
227
|
-
@json_before['type'] = 'base10'
|
228
|
-
expect(json_after).to match(@json_before)
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
context 'Writes (using Webservice.cors)' do
|
233
|
-
before(:example) do
|
234
|
-
out, err = murano_command_run(
|
235
|
-
'setting read', 'Webservice.cors', '-c', 'outformat=json',
|
236
|
-
)
|
237
|
-
expect { @json_before = JSON.parse(out) }.to_not raise_error
|
238
|
-
expect(err).to eq('')
|
239
|
-
end
|
240
|
-
# {'origin'=>true,
|
241
|
-
# 'methods'=>['HEAD', 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
242
|
-
# 'headers'=>['Content-Type', 'Cookie', 'Authorization'],
|
243
|
-
# 'credentials'=>true}
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
data/spec/cmd_status_spec.rb
DELETED
@@ -1,300 +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 'json'
|
10
|
-
require 'open3'
|
11
|
-
require 'os'
|
12
|
-
require 'rbconfig'
|
13
|
-
require 'time'
|
14
|
-
|
15
|
-
require 'cmd_common'
|
16
|
-
|
17
|
-
RSpec.describe 'murano status', :cmd, :needs_password do
|
18
|
-
include_context 'CI_CMD'
|
19
|
-
|
20
|
-
before(:all) do
|
21
|
-
@timeit_time0 = Time.now
|
22
|
-
end
|
23
|
-
|
24
|
-
after(:all) do
|
25
|
-
# FIXME/DRY: Report elapsed time.
|
26
|
-
elapsed_secs = Time.now - @timeit_time0
|
27
|
-
puts "CI_CMD: elapsed_secs: #{elapsed_secs}"
|
28
|
-
end
|
29
|
-
|
30
|
-
before(:example) do
|
31
|
-
@product_name = @snapshotter.resolve_var(
|
32
|
-
'product.name', rname('statusTest')
|
33
|
-
)
|
34
|
-
out, err = murano_command_run(
|
35
|
-
'solution create', '--type', 'product', @product_name, '--save',
|
36
|
-
)
|
37
|
-
expect(err).to eq('')
|
38
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
39
|
-
|
40
|
-
@applctn_name = @snapshotter.resolve_var(
|
41
|
-
'application.name', rname('statusTest')
|
42
|
-
)
|
43
|
-
out, err = murano_command_run(
|
44
|
-
'solution create', '--type', 'application', @applctn_name, '--save',
|
45
|
-
)
|
46
|
-
expect(err).to eq('')
|
47
|
-
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
48
|
-
|
49
|
-
out, err = murano_command_run(
|
50
|
-
'syncdown', '--services', '--no-delete', '--no-update',
|
51
|
-
)
|
52
|
-
# NOTE: 2017-12-14: (landonb): The new behavior is that MurCLI will treat
|
53
|
-
# platform scripts that are simply empty strings as not being in conflict
|
54
|
-
# if the script does not exist locally, in addition to the script existing
|
55
|
-
# locally but also just being an empty string.
|
56
|
-
# Currently, on a fresh solution, only user_account has script contents.
|
57
|
-
# You'll see timer_timer and tsdb_export also existing, but empty.
|
58
|
-
# Search eventhandler.undeletable for more on this issue.
|
59
|
-
olines = out.lines
|
60
|
-
(0..0).each do |ln|
|
61
|
-
expect(olines[ln].to_s).to a_string_starting_with('Adding item ')
|
62
|
-
end
|
63
|
-
|
64
|
-
expect(err).to eq('')
|
65
|
-
end
|
66
|
-
|
67
|
-
after(:example) do
|
68
|
-
out, err = murano_command_run(
|
69
|
-
'solution delete', @applctn_name, '-y',
|
70
|
-
)
|
71
|
-
expect(out).to eq('')
|
72
|
-
expect(err).to eq('')
|
73
|
-
|
74
|
-
out, err = murano_command_run(
|
75
|
-
'solution delete', @product_name, '-y',
|
76
|
-
)
|
77
|
-
expect(out).to eq('')
|
78
|
-
expect(err).to eq('')
|
79
|
-
end
|
80
|
-
|
81
|
-
def match_syncable_contents(slice)
|
82
|
-
expect(slice).to include(
|
83
|
-
a_string_matching(%r{ \+ \w .*modules/table_util\.lua}),
|
84
|
-
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:1-4}),
|
85
|
-
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:5-7}),
|
86
|
-
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:8-11}),
|
87
|
-
a_string_matching(%r{ \+ \w .*routes/singleRoute\.lua:1-5}),
|
88
|
-
a_string_matching(%r{ \+ \w .*files/js/script\.js}),
|
89
|
-
a_string_matching(%r{ \+ \w .*files/icon\.png}),
|
90
|
-
a_string_matching(%r{ \+ \w .*files/index\.html}),
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
def match_syncable_contents_resources(slice)
|
95
|
-
expect(slice).to include(
|
96
|
-
a_string_matching(/ \+ \w state/),
|
97
|
-
a_string_matching(/ \+ \w temperature/),
|
98
|
-
a_string_matching(/ \+ \w uptime/),
|
99
|
-
a_string_matching(/ \+ \w humidity/),
|
100
|
-
)
|
101
|
-
end
|
102
|
-
|
103
|
-
def match_syncable_contents_except_single_route(slice)
|
104
|
-
expect(slice).to include(
|
105
|
-
a_string_matching(%r{ \+ \w .*modules/table_util\.lua}),
|
106
|
-
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:1-4}),
|
107
|
-
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:5-7}),
|
108
|
-
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:8-11}),
|
109
|
-
a_string_matching(%r{ \+ \w .*files/icon\.png}),
|
110
|
-
a_string_matching(%r{ \+ \w .*files/index\.html}),
|
111
|
-
a_string_matching(%r{ \+ \w .*files/js/script\.js}),
|
112
|
-
)
|
113
|
-
end
|
114
|
-
|
115
|
-
def match_remote_boilerplate_v1_0_0_service(slice)
|
116
|
-
expect(slice).to include(
|
117
|
-
a_string_matching(/ - \w user_account\.lua \[phantom\]/),
|
118
|
-
)
|
119
|
-
end
|
120
|
-
|
121
|
-
context 'without ProjectFile' do
|
122
|
-
before(:example) do
|
123
|
-
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
124
|
-
FileUtils.move('assets', 'files')
|
125
|
-
FileUtils.mkpath('specs')
|
126
|
-
FileUtils.copy(
|
127
|
-
File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'),
|
128
|
-
'specs/resources.yaml',
|
129
|
-
)
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'status', :club_20s, :club_10s do
|
133
|
-
out, err = murano_command_run('status')
|
134
|
-
expect(err).to eq('')
|
135
|
-
olines = out.lines
|
136
|
-
expect(olines[0]).to eq("Only on local machine:\n")
|
137
|
-
match_syncable_contents_resources(olines[1..4])
|
138
|
-
match_syncable_contents(olines[5..12])
|
139
|
-
expect(olines[13]).to eq("Nothing new remotely\n")
|
140
|
-
expect(olines[14]).to eq("Nothing that differs\n")
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'matches file path', :broken_on_windows, :club_20s, :club_10s do
|
144
|
-
# capcmd calls shellwords, which escapes strings so that Open3 doesn't
|
145
|
-
# expand them. E.g., **/ would expand to the local directory name.
|
146
|
-
out, err = murano_command_run('status', '**/icon.png')
|
147
|
-
expect(err).to eq('')
|
148
|
-
expect(out.lines).to match(
|
149
|
-
[
|
150
|
-
"Only on local machine:\n",
|
151
|
-
a_string_matching(%r{ \+ \w .*files/icon\.png}),
|
152
|
-
"Nothing new remotely\n",
|
153
|
-
"Nothing that differs\n",
|
154
|
-
]
|
155
|
-
)
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'matches route', :broken_on_windows, :club_20s, :club_10s do
|
159
|
-
out, err = murano_command_run('status', '#put#')
|
160
|
-
expect(err).to eq('')
|
161
|
-
expect(out.lines).to match(
|
162
|
-
[
|
163
|
-
"Only on local machine:\n",
|
164
|
-
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:5-7}),
|
165
|
-
"Nothing new remotely\n",
|
166
|
-
"Nothing that differs\n",
|
167
|
-
]
|
168
|
-
)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
context 'with ProjectFile' do
|
173
|
-
before(:example) do
|
174
|
-
# We previously called syncdown, which created the project/services/
|
175
|
-
# directory, but don't fret, this copy command will overlay files and
|
176
|
-
# it will not overwrite directories (or do nothing to them, either).
|
177
|
-
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
178
|
-
FileUtils.move('assets', 'files')
|
179
|
-
FileUtils.mkpath('specs')
|
180
|
-
FileUtils.copy(
|
181
|
-
File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'),
|
182
|
-
'specs/resources.yaml',
|
183
|
-
)
|
184
|
-
FileUtils.copy(
|
185
|
-
File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml'),
|
186
|
-
'test.murano'
|
187
|
-
)
|
188
|
-
end
|
189
|
-
|
190
|
-
it 'status', :club_20s, :club_10s do
|
191
|
-
out, err = murano_command_run('status')
|
192
|
-
expect(err).to eq('')
|
193
|
-
olines = out.lines
|
194
|
-
|
195
|
-
expect(olines[0]).to eq("Only on local machine:\n")
|
196
|
-
match_syncable_contents_resources(olines[1..4])
|
197
|
-
match_syncable_contents(olines[5..12])
|
198
|
-
expect(olines[13]).to eq("Nothing new remotely\n")
|
199
|
-
|
200
|
-
# NOTE: On Windows, touch doesn't work, so items differ.
|
201
|
-
# Check the platform, e.g., 'linux-gnu', or other.
|
202
|
-
#is_windows = (
|
203
|
-
# RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
204
|
-
#)
|
205
|
-
if OS.windows?
|
206
|
-
expect(olines[14]).to eq("Items that differ:\n")
|
207
|
-
expect(olines[15..16]).to include(
|
208
|
-
a_string_matching(%r{ M \w .*services/timer_timer\.lua}),
|
209
|
-
a_string_matching(%r{ M \w .*services/tsdb_exportJob\.lua}),
|
210
|
-
)
|
211
|
-
else
|
212
|
-
expect(olines[14]).to eq("Nothing that differs\n")
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
context 'with Solutionfile 0.2.0' do
|
218
|
-
before(:example) do
|
219
|
-
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
220
|
-
FileUtils.move('assets', 'files')
|
221
|
-
FileUtils.mkpath('specs')
|
222
|
-
FileUtils.copy(
|
223
|
-
File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'),
|
224
|
-
'specs/resources.yaml'
|
225
|
-
)
|
226
|
-
File.open('Solutionfile.json', 'wb') do |io|
|
227
|
-
io << {
|
228
|
-
default_page: 'index.html',
|
229
|
-
file_dir: 'files',
|
230
|
-
custom_api: 'routes/manyRoutes.lua',
|
231
|
-
modules: {
|
232
|
-
table_util: 'modules/table_util.lua',
|
233
|
-
},
|
234
|
-
event_handler: {
|
235
|
-
device: {
|
236
|
-
datapoint: 'services/devdata.lua',
|
237
|
-
},
|
238
|
-
},
|
239
|
-
}.to_json
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
it 'status', :club_20s, :club_10s do
|
244
|
-
out, err = murano_command_run('status')
|
245
|
-
expect(err).to eq('')
|
246
|
-
# Not a single match, because the order of items within groups can shift
|
247
|
-
olines = out.lines
|
248
|
-
expect(olines[0]).to eq("Only on local machine:\n")
|
249
|
-
match_syncable_contents_resources(olines[1..4])
|
250
|
-
match_syncable_contents_except_single_route(olines[5..11])
|
251
|
-
expect(olines[12]).to eq("Only on remote server:\n")
|
252
|
-
match_remote_boilerplate_v1_0_0_service(olines[13..13])
|
253
|
-
expect(olines[14]).to eq("Nothing that differs\n")
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
# XXX wait, should a Solutionfile even work with Okami?
|
258
|
-
context 'with Solutionfile 0.3.0' do
|
259
|
-
before(:example) do
|
260
|
-
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
261
|
-
FileUtils.move('assets', 'files')
|
262
|
-
FileUtils.mkpath('specs')
|
263
|
-
FileUtils.copy(
|
264
|
-
File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'),
|
265
|
-
'specs/resources.yaml',
|
266
|
-
)
|
267
|
-
File.open('Solutionfile.json', 'wb') do |io|
|
268
|
-
io << {
|
269
|
-
default_page: 'index.html',
|
270
|
-
assets: 'files',
|
271
|
-
routes: 'routes/manyRoutes.lua',
|
272
|
-
# Note that singleRoute.lua is not included, so it won't be seen
|
273
|
-
# by status command.
|
274
|
-
modules: {
|
275
|
-
table_util: 'modules/table_util.lua',
|
276
|
-
},
|
277
|
-
services: {
|
278
|
-
device: {
|
279
|
-
datapoint: 'services/devdata.lua',
|
280
|
-
},
|
281
|
-
},
|
282
|
-
version: '0.3.0',
|
283
|
-
}.to_json
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
it 'status', :club_20s, :club_10s do
|
288
|
-
out, err = murano_command_run('status')
|
289
|
-
expect(err).to eq('')
|
290
|
-
olines = out.lines
|
291
|
-
expect(olines[0]).to eq("Only on local machine:\n")
|
292
|
-
match_syncable_contents_resources(olines[1..4])
|
293
|
-
match_syncable_contents_except_single_route(olines[5..11])
|
294
|
-
expect(olines[12]).to eq("Only on remote server:\n")
|
295
|
-
match_remote_boilerplate_v1_0_0_service(olines[13..13])
|
296
|
-
expect(olines[14]).to eq("Nothing that differs\n")
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|