MuranoCLI 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.rspec +2 -0
- data/.travis.yml +21 -0
- data/Gemfile +27 -0
- data/LICENSE.txt +19 -0
- data/MuranoCLI.gemspec +50 -0
- data/MuranoCLI.iss +50 -0
- data/README.markdown +208 -0
- data/Rakefile +188 -0
- data/TODO.taskpaper +122 -0
- data/bin/mr +8 -0
- data/bin/murano +84 -0
- data/docs/demo.md +109 -0
- data/lib/MrMurano/Account.rb +211 -0
- data/lib/MrMurano/Config-Migrate.rb +47 -0
- data/lib/MrMurano/Config.rb +286 -0
- data/lib/MrMurano/Mock.rb +63 -0
- data/lib/MrMurano/Product-1P-Device.rb +145 -0
- data/lib/MrMurano/Product-Resources.rb +195 -0
- data/lib/MrMurano/Product.rb +358 -0
- data/lib/MrMurano/ProjectFile.rb +349 -0
- data/lib/MrMurano/Solution-Cors.rb +46 -0
- data/lib/MrMurano/Solution-Endpoint.rb +177 -0
- data/lib/MrMurano/Solution-File.rb +150 -0
- data/lib/MrMurano/Solution-ServiceConfig.rb +140 -0
- data/lib/MrMurano/Solution-Services.rb +326 -0
- data/lib/MrMurano/Solution-Users.rb +129 -0
- data/lib/MrMurano/Solution.rb +59 -0
- data/lib/MrMurano/SubCmdGroupContext.rb +49 -0
- data/lib/MrMurano/SyncUpDown.rb +565 -0
- data/lib/MrMurano/commands/assign.rb +57 -0
- data/lib/MrMurano/commands/businessList.rb +45 -0
- data/lib/MrMurano/commands/completion.rb +152 -0
- data/lib/MrMurano/commands/config.rb +67 -0
- data/lib/MrMurano/commands/content.rb +130 -0
- data/lib/MrMurano/commands/cors.rb +30 -0
- data/lib/MrMurano/commands/domain.rb +17 -0
- data/lib/MrMurano/commands/gb.rb +33 -0
- data/lib/MrMurano/commands/init.rb +138 -0
- data/lib/MrMurano/commands/keystore.rb +157 -0
- data/lib/MrMurano/commands/logs.rb +78 -0
- data/lib/MrMurano/commands/mock.rb +63 -0
- data/lib/MrMurano/commands/password.rb +88 -0
- data/lib/MrMurano/commands/postgresql.rb +41 -0
- data/lib/MrMurano/commands/product.rb +14 -0
- data/lib/MrMurano/commands/productCreate.rb +39 -0
- data/lib/MrMurano/commands/productDelete.rb +33 -0
- data/lib/MrMurano/commands/productDevice.rb +84 -0
- data/lib/MrMurano/commands/productDeviceIdCmds.rb +86 -0
- data/lib/MrMurano/commands/productList.rb +45 -0
- data/lib/MrMurano/commands/productWrite.rb +27 -0
- data/lib/MrMurano/commands/show.rb +80 -0
- data/lib/MrMurano/commands/solution.rb +14 -0
- data/lib/MrMurano/commands/solutionCreate.rb +39 -0
- data/lib/MrMurano/commands/solutionDelete.rb +34 -0
- data/lib/MrMurano/commands/solutionList.rb +45 -0
- data/lib/MrMurano/commands/status.rb +92 -0
- data/lib/MrMurano/commands/sync.rb +60 -0
- data/lib/MrMurano/commands/timeseries.rb +115 -0
- data/lib/MrMurano/commands/tsdb.rb +271 -0
- data/lib/MrMurano/commands/usage.rb +23 -0
- data/lib/MrMurano/commands/zshcomplete.erb +112 -0
- data/lib/MrMurano/commands.rb +32 -0
- data/lib/MrMurano/hash.rb +20 -0
- data/lib/MrMurano/http.rb +153 -0
- data/lib/MrMurano/makePretty.rb +75 -0
- data/lib/MrMurano/schema/pf-v1.0.0.yaml +114 -0
- data/lib/MrMurano/schema/sf-v0.2.0.yaml +77 -0
- data/lib/MrMurano/schema/sf-v0.3.0.yaml +78 -0
- data/lib/MrMurano/template/mock.erb +9 -0
- data/lib/MrMurano/template/projectFile.murano.erb +81 -0
- data/lib/MrMurano/verbosing.rb +99 -0
- data/lib/MrMurano/version.rb +4 -0
- data/lib/MrMurano.rb +20 -0
- data/spec/Account-Passwords_spec.rb +242 -0
- data/spec/Account_spec.rb +272 -0
- data/spec/ConfigFile_spec.rb +50 -0
- data/spec/ConfigMigrate_spec.rb +89 -0
- data/spec/Config_spec.rb +409 -0
- data/spec/Http_spec.rb +204 -0
- data/spec/MakePretties_spec.rb +118 -0
- data/spec/Mock_spec.rb +53 -0
- data/spec/ProductBase_spec.rb +113 -0
- data/spec/ProductContent_spec.rb +162 -0
- data/spec/ProductResources_spec.rb +329 -0
- data/spec/Product_1P_Device_spec.rb +202 -0
- data/spec/Product_1P_RPC_spec.rb +175 -0
- data/spec/Product_spec.rb +153 -0
- data/spec/ProjectFile_spec.rb +324 -0
- data/spec/Solution-Cors_spec.rb +164 -0
- data/spec/Solution-Endpoint_spec.rb +581 -0
- data/spec/Solution-File_spec.rb +212 -0
- data/spec/Solution-ServiceConfig_spec.rb +202 -0
- data/spec/Solution-ServiceDevice_spec.rb +176 -0
- data/spec/Solution-ServiceEventHandler_spec.rb +385 -0
- data/spec/Solution-ServiceModules_spec.rb +465 -0
- data/spec/Solution-UsersRoles_spec.rb +207 -0
- data/spec/Solution_spec.rb +92 -0
- data/spec/SyncRoot_spec.rb +83 -0
- data/spec/SyncUpDown_spec.rb +495 -0
- data/spec/Verbosing_spec.rb +279 -0
- data/spec/_workspace.rb +27 -0
- data/spec/cmd_assign_spec.rb +51 -0
- data/spec/cmd_business_spec.rb +59 -0
- data/spec/cmd_common.rb +72 -0
- data/spec/cmd_config_spec.rb +68 -0
- data/spec/cmd_content_spec.rb +71 -0
- data/spec/cmd_cors_spec.rb +50 -0
- data/spec/cmd_device_spec.rb +96 -0
- data/spec/cmd_domain_spec.rb +32 -0
- data/spec/cmd_init_spec.rb +30 -0
- data/spec/cmd_keystore_spec.rb +97 -0
- data/spec/cmd_password_spec.rb +62 -0
- data/spec/cmd_status_spec.rb +239 -0
- data/spec/cmd_syncdown_spec.rb +86 -0
- data/spec/cmd_syncup_spec.rb +62 -0
- data/spec/cmd_usage_spec.rb +36 -0
- data/spec/fixtures/.mrmuranorc +9 -0
- data/spec/fixtures/ProjectFiles/invalid.yaml +9 -0
- data/spec/fixtures/ProjectFiles/only_meta.yaml +24 -0
- data/spec/fixtures/ProjectFiles/with_routes.yaml +27 -0
- data/spec/fixtures/SolutionFiles/0.2.0.json +20 -0
- data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +18 -0
- data/spec/fixtures/SolutionFiles/0.2.json +21 -0
- data/spec/fixtures/SolutionFiles/0.3.0.json +20 -0
- data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +19 -0
- data/spec/fixtures/SolutionFiles/0.3.json +20 -0
- data/spec/fixtures/SolutionFiles/basic.json +20 -0
- data/spec/fixtures/SolutionFiles/secret.json +6 -0
- data/spec/fixtures/configfile +9 -0
- data/spec/fixtures/dumped_config +42 -0
- data/spec/fixtures/mrmuranorc_deleted_bob +8 -0
- data/spec/fixtures/mrmuranorc_tool_bob +3 -0
- data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +116 -0
- data/spec/fixtures/product_spec_files/example.murano.spec.yaml +14 -0
- data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +21 -0
- data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +16 -0
- data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +11 -0
- data/spec/fixtures/product_spec_files/lightbulb.yaml +14 -0
- data/spec/fixtures/roles-three.yaml +11 -0
- 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 +58 -0
- data/spec/fixtures/syncable_content/routes/manyRoutes.lua +11 -0
- data/spec/fixtures/syncable_content/routes/singleRoute.lua +5 -0
- data/spec/fixtures/syncable_content/services/devdata.lua +18 -0
- data/spec/fixtures/syncable_content/services/timers.lua +4 -0
- data/spec/spec_helper.rb +119 -0
- metadata +498 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'open3'
|
3
|
+
require 'pathname'
|
4
|
+
require 'cmd_common'
|
5
|
+
|
6
|
+
RSpec.describe 'murano config', :cmd do
|
7
|
+
include_context "CI_CMD"
|
8
|
+
|
9
|
+
it "Needs a key" do
|
10
|
+
out, err, status = Open3.capture3(capcmd('murano', "config"))
|
11
|
+
expect(status).to eq(0)
|
12
|
+
expect(out).to eq("\e[31mNeed a config key\e[0m\n")
|
13
|
+
expect(err).to eq('')
|
14
|
+
end
|
15
|
+
|
16
|
+
it "Sets a key" do
|
17
|
+
out, err, status = Open3.capture3(capcmd(%w{murano config bob build}))
|
18
|
+
expect(out).to eq('')
|
19
|
+
expect(err).to eq('')
|
20
|
+
expect(status).to eq(0)
|
21
|
+
|
22
|
+
afile = IO.read(File.join(@tmpdir, '.murano/config'))
|
23
|
+
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_tool_bob').read
|
24
|
+
expect(afile).to eq(bfile)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "Sets a user key" do
|
28
|
+
userCfg = File.join(ENV['HOME'], '.murano', 'config')
|
29
|
+
File.unlink(userCfg) if File.exist? userCfg
|
30
|
+
out, err, status = Open3.capture3(capcmd(%w{murano config bob build --user}))
|
31
|
+
expect(status).to eq(0)
|
32
|
+
expect(out).to eq('')
|
33
|
+
expect(err).to eq('')
|
34
|
+
|
35
|
+
afile = IO.read(userCfg)
|
36
|
+
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_tool_bob').read
|
37
|
+
expect(afile).to eq(bfile)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "Reads a key" do
|
41
|
+
FileUtils.mkpath(File.join(@tmpdir, '.murano'))
|
42
|
+
FileUtils.copy_file((@testdir+'spec'+'fixtures'+'.mrmuranorc').to_s,
|
43
|
+
File.join(@tmpdir, '.murano', 'config'),
|
44
|
+
:verbose => true)
|
45
|
+
out, err, status = Open3.capture3(capcmd(%w{murano config --project doThisTest.bob}))
|
46
|
+
expect(status).to eq(0)
|
47
|
+
expect(out).to eq("build\n")
|
48
|
+
expect(err).to eq('')
|
49
|
+
end
|
50
|
+
|
51
|
+
it "Removes a key" do
|
52
|
+
FileUtils.mkpath(File.join(@tmpdir, '.murano'))
|
53
|
+
rcf = File.join(@tmpdir, '.murano', 'config')
|
54
|
+
FileUtils.copy_file((@testdir+'spec'+'fixtures'+'.mrmuranorc').to_s,
|
55
|
+
rcf, :verbose => true)
|
56
|
+
out, err, status = Open3.capture3(capcmd(%w{murano config --project --unset doThisTest.bob}))
|
57
|
+
expect(status).to eq(0)
|
58
|
+
expect(out).to eq('')
|
59
|
+
expect(err).to eq('')
|
60
|
+
|
61
|
+
afile = IO.read(rcf)
|
62
|
+
bfile = (@testdir + 'spec' + 'fixtures' + 'mrmuranorc_deleted_bob').read
|
63
|
+
expect(afile).to eq(bfile)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
# vim: set ai et sw=2 ts=2 :
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'open3'
|
3
|
+
require 'pathname'
|
4
|
+
require 'cmd_common'
|
5
|
+
|
6
|
+
RSpec.describe 'murano content', :cmd, :needs_password do
|
7
|
+
include_context "CI_CMD"
|
8
|
+
|
9
|
+
before(:example) do
|
10
|
+
@project_name = rname('contestTest')
|
11
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @project_name, '--save'))
|
12
|
+
expect(err).to eq('')
|
13
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
14
|
+
expect(status.exitstatus).to eq(0)
|
15
|
+
end
|
16
|
+
after(:example) do
|
17
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'delete', @project_name))
|
18
|
+
expect(out).to eq('')
|
19
|
+
expect(err).to eq('')
|
20
|
+
expect(status.exitstatus).to eq(0)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
it "life cycle" do
|
25
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'list'))
|
26
|
+
expect(out).to eq('')
|
27
|
+
expect(err).to eq('')
|
28
|
+
expect(status.exitstatus).to eq(0)
|
29
|
+
|
30
|
+
FileUtils.copy(File.join(@testdir, 'spec/fixtures/dumped_config'), 'dumped_config')
|
31
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'upload', 'myFile', 'dumped_config', '--meta', 'random junk'))
|
32
|
+
expect(out).to eq('')
|
33
|
+
expect(err).to eq('')
|
34
|
+
expect(status.exitstatus).to eq(0)
|
35
|
+
|
36
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'list'))
|
37
|
+
expect(out).to eq("myFile\n")
|
38
|
+
expect(err).to eq('')
|
39
|
+
expect(status.exitstatus).to eq(0)
|
40
|
+
|
41
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'info', 'myFile'))
|
42
|
+
expect(err).to eq('')
|
43
|
+
olines = out.lines
|
44
|
+
expect(olines[0]).to match(/^(\+-+){5}\+$/)
|
45
|
+
expect(olines[1]).to match(/^\| \S+\s+\| \d+\s+\| \d+\s+\| random junk\s+\| (false|true)\s+\|$/)
|
46
|
+
expect(olines[2]).to match(/^(\+-+){5}\+$/)
|
47
|
+
expect(status.exitstatus).to eq(0)
|
48
|
+
|
49
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'download', 'myFile', '-o', 'testDown'))
|
50
|
+
expect(out).to eq('')
|
51
|
+
expect(err).to eq('')
|
52
|
+
expect(status.exitstatus).to eq(0)
|
53
|
+
expect(File.exist?('testDown')).to be true
|
54
|
+
dcf = IO.read('dumped_config')
|
55
|
+
tdf = IO.read('testDown')
|
56
|
+
expect(tdf).to eq(dcf)
|
57
|
+
|
58
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'delete', 'myFile'))
|
59
|
+
expect(out).to eq('')
|
60
|
+
expect(err).to eq('')
|
61
|
+
expect(status.exitstatus).to eq(0)
|
62
|
+
|
63
|
+
out, err, status = Open3.capture3(capcmd('murano', 'content', 'list'))
|
64
|
+
expect(out).to eq('')
|
65
|
+
expect(err).to eq('')
|
66
|
+
expect(status.exitstatus).to eq(0)
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
# vim: set ai et sw=2 ts=2 :
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'open3'
|
3
|
+
require 'pathname'
|
4
|
+
require 'json'
|
5
|
+
require 'cmd_common'
|
6
|
+
|
7
|
+
RSpec.describe 'murano cors', :cmd, :needs_password do
|
8
|
+
include_context "CI_CMD"
|
9
|
+
|
10
|
+
before(:example) do
|
11
|
+
@project_name = rname('corstest')
|
12
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'create', @project_name, '--save'))
|
13
|
+
expect(err).to eq('')
|
14
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
15
|
+
expect(status.exitstatus).to eq(0)
|
16
|
+
end
|
17
|
+
after(:example) do
|
18
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @project_name))
|
19
|
+
expect(out).to eq('')
|
20
|
+
expect(err).to eq('')
|
21
|
+
expect(status.exitstatus).to eq(0)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "show CORS" do
|
25
|
+
out, err, status = Open3.capture3(capcmd('murano', 'cors', '-c', 'outformat=json'))
|
26
|
+
expect { JSON.parse(out) }.to_not raise_error
|
27
|
+
expect(err).to eq('')
|
28
|
+
expect(status.exitstatus).to eq(0)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "sets cors" do
|
32
|
+
File.open('cors.yaml', 'wb') do |io|
|
33
|
+
io << {:origin=>['http://localhost:*']}.to_json
|
34
|
+
end
|
35
|
+
|
36
|
+
out, err, status = Open3.capture3(capcmd('murano', 'cors', 'set', 'cors.yaml'))
|
37
|
+
expect(out).to eq('')
|
38
|
+
expect(err).to eq('')
|
39
|
+
expect(status.exitstatus).to eq(0)
|
40
|
+
|
41
|
+
out, err, status = Open3.capture3(capcmd('murano', 'cors', '-c', 'outformat=json'))
|
42
|
+
expect { out = JSON.parse(out) }.to_not raise_error
|
43
|
+
expect(out).to include('origin' => contain_exactly('http://localhost:*'))
|
44
|
+
expect(err).to eq('')
|
45
|
+
expect(status.exitstatus).to eq(0)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
# vim: set ai et sw=2 ts=2 :
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'open3'
|
3
|
+
require 'pathname'
|
4
|
+
require 'cmd_common'
|
5
|
+
|
6
|
+
RSpec.describe 'murano device', :cmd, :needs_password do
|
7
|
+
include_context "CI_CMD"
|
8
|
+
|
9
|
+
before(:example) do
|
10
|
+
@project_name = rname('deviceTest')
|
11
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @project_name, '--save'))
|
12
|
+
expect(err).to eq('')
|
13
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
14
|
+
expect(status.exitstatus).to eq(0)
|
15
|
+
end
|
16
|
+
after(:example) do
|
17
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'delete', @project_name))
|
18
|
+
expect(out).to eq('')
|
19
|
+
expect(err).to eq('')
|
20
|
+
expect(status.exitstatus).to eq(0)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "enables and lists" do
|
24
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'enable', '12345'))
|
25
|
+
expect(out).to eq('')
|
26
|
+
expect(err).to eq('')
|
27
|
+
expect(status.exitstatus).to eq(0)
|
28
|
+
|
29
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'list'))
|
30
|
+
expect(err).to eq('')
|
31
|
+
olines = out.lines
|
32
|
+
expect(olines[0]).to match(/^(\+-+){3}\+$/)
|
33
|
+
expect(olines[1]).to match(/^\| SN\s+\| Status\s+\| RID\s+\|$/)
|
34
|
+
expect(olines[2]).to match(/^(\+-+){3}\+$/)
|
35
|
+
expect(olines[3]).to match(/^\| 12345\s+\| notactivated\s+\| \h{40}\s+\|$/)
|
36
|
+
expect(olines[4]).to match(/^(\+-+){3}\+$/)
|
37
|
+
expect(status.exitstatus).to eq(0)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "activates" do
|
41
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'enable', '12345'))
|
42
|
+
expect(out).to eq('')
|
43
|
+
expect(err).to eq('')
|
44
|
+
expect(status.exitstatus).to eq(0)
|
45
|
+
|
46
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'activate', '12345'))
|
47
|
+
expect(out.chomp).to match(/^\h{40}$/)
|
48
|
+
expect(err).to eq('')
|
49
|
+
expect(status.exitstatus).to eq(0)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "writes and reads" do
|
53
|
+
FileUtils.mkpath('specs')
|
54
|
+
FileUtils.copy(File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'), 'specs/resources.yaml')
|
55
|
+
|
56
|
+
out, err, status = Open3.capture3(capcmd('murano', 'syncup', '--specs'))
|
57
|
+
expect(out).to eq('')
|
58
|
+
expect(err).to eq('')
|
59
|
+
expect(status.exitstatus).to eq(0)
|
60
|
+
|
61
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'enable', '12345'))
|
62
|
+
expect(out).to eq('')
|
63
|
+
expect(err).to eq('')
|
64
|
+
expect(status.exitstatus).to eq(0)
|
65
|
+
|
66
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'activate', '12345'))
|
67
|
+
expect(out.chomp).to match(/^\h{40}$/)
|
68
|
+
expect(err).to eq('')
|
69
|
+
expect(status.exitstatus).to eq(0)
|
70
|
+
|
71
|
+
# out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'twee', '12345'))
|
72
|
+
# expect(err).to eq('')
|
73
|
+
# olines = out.lines
|
74
|
+
# expect(olines[0]).to match(/^(\+-+){4}\+$/)
|
75
|
+
# expect(olines[1]).to match(/^\|\s+12345\s+activated\s+\|$/)
|
76
|
+
# expect(olines[2]).to match(/^(\+-+){4}\+$/)
|
77
|
+
# expect(olines[3]).to match(/^\| Resource\s+\| Format\s+\| Modified\s+\| Value\s+\|$/)
|
78
|
+
# expect(olines[4]).to match(/^(\+-+){4}\+$/)
|
79
|
+
# expect(olines[-1]).to match(/^(\+-+){4}\+$/)
|
80
|
+
# expect(status.exitstatus).to eq(0)
|
81
|
+
|
82
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'write', '12345', 'state', '42'))
|
83
|
+
expect(out).to eq("state: ok\n")
|
84
|
+
expect(err).to eq('')
|
85
|
+
expect(status.exitstatus).to eq(0)
|
86
|
+
|
87
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'device', 'read', '12345', 'state'))
|
88
|
+
expect(out.strip).to eq('42')
|
89
|
+
expect(err).to eq('')
|
90
|
+
expect(status.exitstatus).to eq(0)
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
# vim: set ai et sw=2 ts=2 :
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'open3'
|
3
|
+
require 'pathname'
|
4
|
+
require 'cmd_common'
|
5
|
+
|
6
|
+
RSpec.describe 'murano domain', :cmd, :needs_password do
|
7
|
+
include_context "CI_CMD"
|
8
|
+
|
9
|
+
before(:example) do
|
10
|
+
@project_name = rname('domainTest')
|
11
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'create', @project_name, '--save'))
|
12
|
+
expect(err).to eq('')
|
13
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
14
|
+
expect(status.exitstatus).to eq(0)
|
15
|
+
end
|
16
|
+
after(:example) do
|
17
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @project_name))
|
18
|
+
expect(out).to eq('')
|
19
|
+
expect(err).to eq('')
|
20
|
+
expect(status.exitstatus).to eq(0)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "show domain" do
|
24
|
+
out, err, status = Open3.capture3(capcmd('murano', 'domain'))
|
25
|
+
expect(out.chomp).to eq("#{@project_name}.apps.exosite.io")
|
26
|
+
expect(err).to eq('')
|
27
|
+
expect(status.exitstatus).to eq(0)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# vim: set ai et sw=2 ts=2 :
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'open3'
|
3
|
+
require 'pathname'
|
4
|
+
require 'cmd_common'
|
5
|
+
|
6
|
+
RSpec.describe 'mr init', :cmd do
|
7
|
+
include_context "CI_CMD"
|
8
|
+
|
9
|
+
it "Won't init in HOME (gracefully)" do
|
10
|
+
# this is in the project dir. Want to be in HOME
|
11
|
+
Dir.chdir(ENV['HOME']) do
|
12
|
+
out, err, status = Open3.capture3(capcmd('murano', 'init'))
|
13
|
+
expect(out).to eq("\n")
|
14
|
+
expect(err).to eq("\e[31mCannot init a project in your HOME directory.\e[0m\n")
|
15
|
+
expect(status.exitstatus).to eq(2)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# TODO The way init works is changing with the ProjectFile
|
20
|
+
# So hold off on this test.
|
21
|
+
# it "Asks to import if Solutionfile exists" do
|
22
|
+
# FileUtils.touch('Solutionfile.json')
|
23
|
+
# out, err, status = Open3.capture3(capcmd('murano', 'init'), :stdin_data=>'y')
|
24
|
+
# expect(out).to eq("\nA Solutionfile.json exists, Do you want exit and run `murano config import` instead? [yN]\n")
|
25
|
+
# expect(err).to eq("")
|
26
|
+
# expect(status.exitstatus).to eq(0)
|
27
|
+
# end
|
28
|
+
|
29
|
+
end
|
30
|
+
# vim: set ai et sw=2 ts=2 :
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'open3'
|
3
|
+
require 'pathname'
|
4
|
+
require 'json'
|
5
|
+
require 'cmd_common'
|
6
|
+
|
7
|
+
RSpec.describe 'murano keystore', :cmd, :needs_password do
|
8
|
+
include_context "CI_CMD"
|
9
|
+
|
10
|
+
before(:example) do
|
11
|
+
@project_name = rname('keystoreTest')
|
12
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'create', @project_name, '--save'))
|
13
|
+
expect(err).to eq('')
|
14
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
15
|
+
expect(status.exitstatus).to eq(0)
|
16
|
+
|
17
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'set', 'bob', 'built'))
|
18
|
+
expect(out.chomp).to eq('')
|
19
|
+
expect(err).to eq('')
|
20
|
+
expect(status.exitstatus).to eq(0)
|
21
|
+
end
|
22
|
+
after(:example) do
|
23
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @project_name))
|
24
|
+
expect(out).to eq('')
|
25
|
+
expect(err).to eq('')
|
26
|
+
expect(status.exitstatus).to eq(0)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "gets" do
|
30
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'get', 'bob'))
|
31
|
+
expect(out.chomp).to eq('built')
|
32
|
+
expect(err).to eq('')
|
33
|
+
expect(status.exitstatus).to eq(0)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "lists" do
|
37
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'list'))
|
38
|
+
expect(out.chomp).to eq('bob')
|
39
|
+
expect(err).to eq('')
|
40
|
+
expect(status.exitstatus).to eq(0)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "infos" do
|
44
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'info', '-c', 'outformat=json'))
|
45
|
+
expect{out = JSON.parse(out)}.to_not raise_error
|
46
|
+
expect(err).to eq('')
|
47
|
+
expect(status.exitstatus).to eq(0)
|
48
|
+
expect(out).to match(
|
49
|
+
'quota'=>{'keys' => a_kind_of(Integer)},
|
50
|
+
'usage'=>{'keys' => 1, 'size' => a_kind_of(Integer)},
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "deletes" do
|
55
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'delete', 'bob'))
|
56
|
+
expect(out.chomp).to eq('')
|
57
|
+
expect(err).to eq('')
|
58
|
+
expect(status.exitstatus).to eq(0)
|
59
|
+
|
60
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'list'))
|
61
|
+
expect(out.chomp).to eq('')
|
62
|
+
expect(err).to eq('')
|
63
|
+
expect(status.exitstatus).to eq(0)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "clearAll" do
|
67
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'set', 'another', 'value'))
|
68
|
+
expect(out.chomp).to eq('')
|
69
|
+
expect(err).to eq('')
|
70
|
+
expect(status.exitstatus).to eq(0)
|
71
|
+
|
72
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'clearAll'))
|
73
|
+
expect(out.chomp).to eq('')
|
74
|
+
expect(err).to eq('')
|
75
|
+
expect(status.exitstatus).to eq(0)
|
76
|
+
|
77
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'list'))
|
78
|
+
expect(out.chomp).to eq('')
|
79
|
+
expect(err).to eq('')
|
80
|
+
expect(status.exitstatus).to eq(0)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "can call other commands" do
|
84
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'command', 'lpush', 'another', 'value'))
|
85
|
+
expect(out.chomp).to eq('1')
|
86
|
+
expect(err).to eq('')
|
87
|
+
expect(status.exitstatus).to eq(0)
|
88
|
+
|
89
|
+
out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'command', 'rpop', 'another'))
|
90
|
+
expect(out.chomp).to eq('value')
|
91
|
+
expect(err).to eq('')
|
92
|
+
expect(status.exitstatus).to eq(0)
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
# vim: set ai et sw=2 ts=2 :
|