MuranoCLI 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +30 -59
- data/Gemfile +9 -3
- data/MuranoCLI.gemspec +11 -4
- data/bin/murano +2 -90
- data/lib/MrMurano.rb +5 -1
- data/lib/MrMurano/{spec_commander.rb → Commander-Entry.rb} +1 -2
- data/lib/MrMurano/Solution.rb +12 -15
- data/lib/MrMurano/SolutionId.rb +1 -5
- data/lib/MrMurano/SyncAllowed.rb +2 -2
- data/lib/MrMurano/SyncUpDown.rb +6 -3
- data/lib/MrMurano/progress.rb +11 -2
- data/lib/MrMurano/verbosing.rb +3 -2
- data/lib/MrMurano/version.rb +2 -2
- data/spec/Account-Passwords_spec.rb +34 -48
- data/spec/Account_spec.rb +58 -63
- data/spec/Business_spec.rb +151 -139
- data/spec/ConfigFile_spec.rb +15 -11
- data/spec/ConfigMigrate_spec.rb +23 -12
- data/spec/Config_spec.rb +57 -54
- data/spec/Content_spec.rb +233 -201
- data/spec/GatewayBase_spec.rb +35 -27
- data/spec/GatewayDevice_spec.rb +149 -149
- data/spec/GatewayResource_spec.rb +115 -102
- data/spec/GatewaySettings_spec.rb +69 -62
- data/spec/Http_spec.rb +66 -56
- data/spec/MakePretties_spec.rb +82 -73
- data/spec/Mock_spec.rb +38 -29
- data/spec/ProjectFile_spec.rb +118 -106
- data/spec/Setting_spec.rb +24 -15
- data/spec/Solution-ServiceConfig_spec.rb +168 -140
- data/spec/Solution-ServiceEventHandler_spec.rb +186 -188
- data/spec/Solution-ServiceModules_spec.rb +314 -232
- data/spec/Solution-UsersRoles_spec.rb +136 -86
- data/spec/Solution_spec.rb +78 -50
- data/spec/SyncRoot_spec.rb +26 -24
- data/spec/SyncUpDown_spec.rb +268 -249
- data/spec/Verbosing_spec.rb +95 -93
- data/spec/Webservice-Cors_spec.rb +141 -95
- data/spec/Webservice-Endpoint_spec.rb +382 -346
- data/spec/Webservice-File_spec.rb +148 -109
- data/spec/Webservice-Setting_spec.rb +47 -41
- data/spec/cmd_business_spec.rb +17 -17
- data/spec/cmd_common.rb +27 -7
- data/spec/cmd_config_spec.rb +31 -20
- data/spec/cmd_content_spec.rb +80 -68
- data/spec/cmd_cors_spec.rb +11 -5
- data/spec/cmd_device_spec.rb +16 -14
- data/spec/cmd_domain_spec.rb +10 -8
- data/spec/cmd_exchange_spec.rb +3 -3
- data/spec/cmd_init_spec.rb +100 -101
- data/spec/cmd_keystore_spec.rb +17 -12
- data/spec/cmd_link_spec.rb +22 -37
- data/spec/cmd_password_spec.rb +11 -7
- data/spec/cmd_setting_application_spec.rb +47 -33
- data/spec/cmd_setting_product_spec.rb +32 -27
- data/spec/cmd_status_spec.rb +125 -114
- data/spec/cmd_syncdown_spec.rb +70 -65
- data/spec/cmd_syncup_spec.rb +19 -15
- data/spec/cmd_usage_spec.rb +14 -10
- metadata +29 -15
@@ -1,12 +1,19 @@
|
|
1
|
+
# Last Modified: 2017.09.13 /coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright © 2016-2017 Exosite LLC.
|
5
|
+
# License: MIT. See LICENSE.txt.
|
6
|
+
# vim:tw=0:ts=2:sw=2:et:ai
|
7
|
+
|
1
8
|
require 'fileutils'
|
9
|
+
require 'json'
|
2
10
|
require 'open3'
|
3
11
|
require 'pathname'
|
4
|
-
require 'json'
|
5
12
|
require 'vine'
|
6
13
|
require 'cmd_common'
|
7
14
|
|
8
15
|
RSpec.describe 'murano setting', :cmd, :needs_password do
|
9
|
-
include_context
|
16
|
+
include_context 'CI_CMD'
|
10
17
|
|
11
18
|
before(:example) do
|
12
19
|
@product_name = rname('settingtest')
|
@@ -22,16 +29,16 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
22
29
|
expect(status.exitstatus).to eq(0)
|
23
30
|
end
|
24
31
|
|
25
|
-
context
|
32
|
+
context 'Writes (using Device2.identity_format)' do
|
26
33
|
before(:example) do
|
27
34
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Device2.identity_format', '-c', 'outformat=json'))
|
28
35
|
expect { @json_before = JSON.parse(out) }.to_not raise_error
|
29
36
|
expect(err).to eq('')
|
30
37
|
expect(status.exitstatus).to eq(0)
|
31
38
|
end
|
32
|
-
# {
|
39
|
+
# {'prefix'=>'', 'type'=>'opaque', 'options'=>{'casing'=>'mixed', 'length'=>0}}
|
33
40
|
|
34
|
-
it
|
41
|
+
it 'a string value' do
|
35
42
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'prefix', 'fidget'))
|
36
43
|
expect(err).to eq('')
|
37
44
|
expect(out).to eq('')
|
@@ -46,7 +53,7 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
46
53
|
expect(json_after).to match(@json_before)
|
47
54
|
end
|
48
55
|
|
49
|
-
it
|
56
|
+
it 'a forced string value' do
|
50
57
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'prefix', '--string', 'fidget'))
|
51
58
|
expect(err).to eq('')
|
52
59
|
expect(out).to eq('')
|
@@ -61,8 +68,8 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
61
68
|
expect(json_after).to match(@json_before)
|
62
69
|
end
|
63
70
|
|
64
|
-
it
|
65
|
-
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'prefix', '--string'), :
|
71
|
+
it 'a forced string value on STDIN' do
|
72
|
+
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'prefix', '--string'), stdin_data: 'fidget')
|
66
73
|
expect(err).to eq('')
|
67
74
|
expect(out).to eq('')
|
68
75
|
expect(status.exitstatus).to eq(0)
|
@@ -77,7 +84,7 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
77
84
|
end
|
78
85
|
|
79
86
|
# This may not be testable in integration. (since it does things that get filtered out)
|
80
|
-
it
|
87
|
+
it 'all intermediate keys' #do
|
81
88
|
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'one.two.three', 'fidget'))
|
82
89
|
# expect(err).to eq('')
|
83
90
|
# expect(out).to eq('')
|
@@ -92,8 +99,8 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
92
99
|
# expect(json_after).to match(@json_before)
|
93
100
|
# end
|
94
101
|
|
95
|
-
context
|
96
|
-
it
|
102
|
+
context 'a number value' do
|
103
|
+
it 'integer 12' do
|
97
104
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options.length', '--num', '12'))
|
98
105
|
expect(err).to eq('')
|
99
106
|
expect(out).to eq('')
|
@@ -108,7 +115,7 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
108
115
|
expect(json_after).to match(@json_before)
|
109
116
|
end
|
110
117
|
|
111
|
-
it
|
118
|
+
it 'float 12.67' do
|
112
119
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options.length', '--num', '12.67'))
|
113
120
|
expect(err).to eq('')
|
114
121
|
expect(out).to eq('')
|
@@ -123,15 +130,15 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
123
130
|
expect(json_after).to match(@json_before)
|
124
131
|
end
|
125
132
|
|
126
|
-
it
|
133
|
+
it 'fiftyHalf' do
|
127
134
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options.length', '--num', 'fiftyHalf'))
|
128
135
|
expect(err).to eq("\e[31mValue \"fiftyHalf\" is not a number\e[0m\n")
|
129
136
|
expect(out).to eq('')
|
130
137
|
expect(status.exitstatus).to eq(2)
|
131
138
|
end
|
132
139
|
|
133
|
-
it
|
134
|
-
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options.length', '--num'), :
|
140
|
+
it 'on STDIN' do
|
141
|
+
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options.length', '--num'), stdin_data: '12')
|
135
142
|
expect(err).to eq('')
|
136
143
|
expect(out).to eq('')
|
137
144
|
expect(status.exitstatus).to eq(0)
|
@@ -146,13 +153,13 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
146
153
|
end
|
147
154
|
end
|
148
155
|
|
149
|
-
it
|
156
|
+
it 'a json object blob' #do
|
150
157
|
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'type', 'base16'))
|
151
158
|
# expect(err).to eq('')
|
152
159
|
# expect(out).to eq('')
|
153
160
|
# expect(status.exitstatus).to eq(0)
|
154
161
|
#
|
155
|
-
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options', '--json', '
|
162
|
+
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options', '--json', "{'casing': 'lower', 'length': 0}"))
|
156
163
|
# expect(err).to eq('')
|
157
164
|
# expect(out).to eq('')
|
158
165
|
# expect(status.exitstatus).to eq(0)
|
@@ -167,10 +174,10 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
167
174
|
# expect(json_after).to match(@json_before)
|
168
175
|
# end
|
169
176
|
|
170
|
-
it
|
177
|
+
it 'a json object blob with stdin'
|
171
178
|
|
172
179
|
# This may not be testable in integration.
|
173
|
-
it
|
180
|
+
it 'a dictionary' #do
|
174
181
|
# out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', 'options', '--dict', 'casing', 'lower'))
|
175
182
|
# expect(err).to eq('')
|
176
183
|
# expect(out).to eq('')
|
@@ -185,7 +192,7 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
185
192
|
# expect(json_after).to match(@json_before)
|
186
193
|
# end
|
187
194
|
|
188
|
-
it
|
195
|
+
it 'merges into a dictionary' do
|
189
196
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Device2.identity_format', '.', '--dict', '--merge', 'prefix', 'tix', 'type', 'base10'))
|
190
197
|
expect(err).to eq('')
|
191
198
|
expect(out).to eq('')
|
@@ -202,19 +209,17 @@ RSpec.describe 'murano setting', :cmd, :needs_password do
|
|
202
209
|
end
|
203
210
|
end
|
204
211
|
|
205
|
-
context
|
212
|
+
context 'Writes (using Webservice.cors)' do
|
206
213
|
before(:example) do
|
207
214
|
out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
|
208
215
|
expect { @json_before = JSON.parse(out) }.to_not raise_error
|
209
216
|
expect(err).to eq('')
|
210
217
|
expect(status.exitstatus).to eq(0)
|
211
218
|
end
|
212
|
-
# {
|
213
|
-
#
|
214
|
-
#
|
215
|
-
#
|
219
|
+
# {'origin'=>true,
|
220
|
+
# 'methods'=>['HEAD', 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
221
|
+
# 'headers'=>['Content-Type', 'Cookie', 'Authorization'],
|
222
|
+
# 'credentials'=>true}
|
216
223
|
end
|
217
|
-
|
218
224
|
end
|
219
225
|
|
220
|
-
# vim: set ai et sw=2 ts=2 :
|
data/spec/cmd_status_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Last Modified: 2017.
|
2
|
-
# frozen_string_literal:
|
1
|
+
# Last Modified: 2017.09.12 /coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# Copyright © 2016-2017 Exosite LLC.
|
5
5
|
# License: MIT. See LICENSE.txt.
|
@@ -8,13 +8,14 @@
|
|
8
8
|
require 'fileutils'
|
9
9
|
require 'json'
|
10
10
|
require 'open3'
|
11
|
+
require 'os'
|
11
12
|
require 'pathname'
|
12
13
|
require 'rbconfig'
|
13
14
|
|
14
15
|
require 'cmd_common'
|
15
16
|
|
16
17
|
RSpec.describe 'murano status', :cmd, :needs_password do
|
17
|
-
include_context
|
18
|
+
include_context 'CI_CMD'
|
18
19
|
|
19
20
|
before(:example) do
|
20
21
|
@product_name = rname('statusTest')
|
@@ -47,8 +48,8 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
47
48
|
# pre-exist, in a sense, and are therefore described as being updated,
|
48
49
|
# not added.
|
49
50
|
(0..2).each do |ln|
|
50
|
-
#expect(olines[ln].to_s).to a_string_starting_with(
|
51
|
-
expect(olines[ln].to_s).to a_string_starting_with(
|
51
|
+
#expect(olines[ln].to_s).to a_string_starting_with('Adding item ')
|
52
|
+
expect(olines[ln].to_s).to a_string_starting_with('Updating item ')
|
52
53
|
end
|
53
54
|
|
54
55
|
expect(err).to eq('')
|
@@ -68,79 +69,79 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
68
69
|
end
|
69
70
|
|
70
71
|
def match_syncable_contents(slice)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
72
|
+
expect(slice).to include(
|
73
|
+
a_string_matching(%r{ \+ \w .*modules/table_util\.lua}),
|
74
|
+
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua}),
|
75
|
+
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:4}),
|
76
|
+
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:7}),
|
77
|
+
# singleRoute only appears in some of the tests.
|
78
|
+
a_string_matching(%r{ \+ \w .*routes/singleRoute\.lua}),
|
79
|
+
a_string_matching(%r{ \+ \w .*files/js/script\.js}),
|
80
|
+
a_string_matching(%r{ \+ \w .*files/icon\.png}),
|
81
|
+
a_string_matching(%r{ \+ \w .*files/index\.html}),
|
82
|
+
)
|
82
83
|
end
|
83
84
|
|
84
85
|
def match_syncable_contents_resources(slice)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
expect(slice).to include(
|
87
|
+
a_string_matching(/ \+ \w state/),
|
88
|
+
a_string_matching(/ \+ \w temperature/),
|
89
|
+
a_string_matching(/ \+ \w uptime/),
|
90
|
+
a_string_matching(/ \+ \w humidity/),
|
91
|
+
)
|
91
92
|
end
|
92
93
|
|
93
|
-
def
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
94
|
+
def match_syncable_contents_except_single_route(slice)
|
95
|
+
expect(slice).to include(
|
96
|
+
a_string_matching(%r{ \+ \w .*modules/table_util\.lua}),
|
97
|
+
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua}),
|
98
|
+
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:4}),
|
99
|
+
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:7}),
|
100
|
+
# singleRoute does not appear in old Solutionfile tests
|
101
|
+
# that don't specify it.
|
102
|
+
#a_string_matching(%r{ \+ \w .*routes/singleRoute\.lua}),
|
103
|
+
a_string_matching(%r{ \+ \w .*files/js/script\.js}),
|
104
|
+
a_string_matching(%r{ \+ \w .*files/icon\.png}),
|
105
|
+
a_string_matching(%r{ \+ \w .*files/index\.html}),
|
106
|
+
)
|
106
107
|
end
|
107
108
|
|
108
109
|
def match_remote_boilerplate_v1_0_0_service(slice)
|
109
110
|
expect(slice).to include(
|
110
|
-
#a_string_matching(
|
111
|
-
#a_string_matching(
|
112
|
-
#a_string_matching(
|
113
|
-
#a_string_matching(
|
114
|
-
#a_string_matching(
|
115
|
-
#a_string_matching(
|
116
|
-
#a_string_matching(
|
117
|
-
#a_string_matching(
|
118
|
-
#a_string_matching(
|
119
|
-
#a_string_matching(
|
120
|
-
#a_string_matching(
|
121
|
-
#a_string_matching(
|
122
|
-
#a_string_matching(
|
123
|
-
#a_string_matching(
|
124
|
-
#a_string_matching(
|
125
|
-
#a_string_matching(
|
126
|
-
#a_string_matching(
|
127
|
-
#a_string_matching(
|
128
|
-
#a_string_matching(
|
129
|
-
#a_string_matching(
|
130
|
-
#a_string_matching(
|
131
|
-
#a_string_matching(
|
132
|
-
#a_string_matching(
|
133
|
-
#a_string_matching(
|
134
|
-
#a_string_matching(
|
135
|
-
#a_string_matching(
|
136
|
-
#a_string_matching(
|
111
|
+
#a_string_matching(%r{ - \w device2_event}),
|
112
|
+
#a_string_matching(%r{ - \w interface_addGatewayResource}),
|
113
|
+
#a_string_matching(%r{ - \w interface_addIdentity}),
|
114
|
+
#a_string_matching(%r{ - \w interface_clearContent}),
|
115
|
+
#a_string_matching(%r{ - \w interface_deleteContent}),
|
116
|
+
#a_string_matching(%r{ - \w interface_downloadContent}),
|
117
|
+
#a_string_matching(%r{ - \w interface_getGatewayResource}),
|
118
|
+
#a_string_matching(%r{ - \w interface_getGatewaySettings}),
|
119
|
+
#a_string_matching(%r{ - \w interface_getIdentity}),
|
120
|
+
#a_string_matching(%r{ - \w interface_getIdentityState}),
|
121
|
+
#a_string_matching(%r{ - \w interface_infoContent}),
|
122
|
+
#a_string_matching(%r{ - \w interface_listContent}),
|
123
|
+
#a_string_matching(%r{ - \w interface_listIdentities}),
|
124
|
+
#a_string_matching(%r{ - \w interface_makeIdentity}),
|
125
|
+
#a_string_matching(%r{ - \w interface_removeGatewayResource}),
|
126
|
+
#a_string_matching(%r{ - \w interface_removeIdentity}),
|
127
|
+
#a_string_matching(%r{ - \w interface_setIdentityState}),
|
128
|
+
#a_string_matching(%r{ - \w interface_updateGatewayResource}),
|
129
|
+
#a_string_matching(%r{ - \w interface_updateGatewaySettings}),
|
130
|
+
#a_string_matching(%r{ - \w interface_updateIdentity}),
|
131
|
+
#a_string_matching(%r{ - \w interface_uploadContent}),
|
132
|
+
#a_string_matching(%r{ - \w timer_timer (Application Event Handlers)}),
|
133
|
+
#a_string_matching(%r{ - \w tsdb_exportJob (Application Event Handlers)}),
|
134
|
+
#a_string_matching(%r{ - \w user_account (Application Event Handlers)}),
|
135
|
+
#a_string_matching(%r{ - \w timer_timer}),
|
136
|
+
#a_string_matching(%r{ - \w tsdb_exportJob}),
|
137
|
+
#a_string_matching(%r{ - \w user_account}),
|
137
138
|
a_string_matching(/ M \w timer_timer\.lua/),
|
138
139
|
a_string_matching(/ M \w tsdb_exportJob\.lua/),
|
139
140
|
a_string_matching(/ M \w user_account\.lua/),
|
140
141
|
)
|
141
142
|
end
|
142
143
|
|
143
|
-
context
|
144
|
+
context 'without ProjectFile' do
|
144
145
|
before(:example) do
|
145
146
|
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
146
147
|
FileUtils.move('assets', 'files')
|
@@ -151,7 +152,7 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
151
152
|
)
|
152
153
|
end
|
153
154
|
|
154
|
-
it
|
155
|
+
it 'status' do
|
155
156
|
out, err, status = Open3.capture3(capcmd('murano', 'status'))
|
156
157
|
expect(err).to eq('')
|
157
158
|
# Two problems with this output.
|
@@ -170,49 +171,55 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
170
171
|
#match_remote_boilerplate_v1_0_0_service(olines[14..35])
|
171
172
|
|
172
173
|
# NOTE: On Windows, touch doesn't work, so items differ.
|
173
|
-
# Check the platform, e.g.,
|
174
|
+
# Check the platform, e.g., 'linux-gnu', or other.
|
174
175
|
# 2017-07-14 08:51: Is there a race condition here? [lb] saw
|
175
176
|
# differences earlier, but then not after adding this...
|
176
|
-
#is_windows = (
|
177
|
-
#
|
177
|
+
#is_windows = (
|
178
|
+
# RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
179
|
+
#)
|
180
|
+
#if OS.windows?
|
178
181
|
# expect(olines[14]).to eq("Items that differ:\n")
|
179
182
|
# expect(olines[15..16]).to contain_exactly(
|
180
|
-
# a_string_matching(
|
181
|
-
# a_string_matching(
|
183
|
+
# a_string_matching(%r{ M \w .*services/timer_timer\.lua}),
|
184
|
+
# a_string_matching(%r{ M \w .*services/tsdb_exportJob\.lua}),
|
182
185
|
# )
|
183
186
|
#else
|
184
|
-
|
187
|
+
expect(olines[14]).to eq("Nothing that differs\n")
|
185
188
|
#end
|
186
189
|
|
187
190
|
expect(status.exitstatus).to eq(0)
|
188
191
|
end
|
189
192
|
|
190
|
-
it
|
193
|
+
it 'matches file path', :broken_on_windows do
|
191
194
|
out, err, status = Open3.capture3(capcmd('murano', 'status', '**/icon.png'))
|
192
195
|
expect(err).to eq('')
|
193
|
-
expect(out.lines).to match(
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
196
|
+
expect(out.lines).to match(
|
197
|
+
[
|
198
|
+
"Only on local machine:\n",
|
199
|
+
a_string_matching(%r{ \+ \w .*files/icon\.png}),
|
200
|
+
"Nothing new remotely\n",
|
201
|
+
"Nothing that differs\n",
|
202
|
+
]
|
203
|
+
)
|
199
204
|
expect(status.exitstatus).to eq(0)
|
200
205
|
end
|
201
206
|
|
202
|
-
it
|
207
|
+
it 'matches route', :broken_on_windows do
|
203
208
|
out, err, status = Open3.capture3(capcmd('murano', 'status', '#put#'))
|
204
209
|
expect(err).to eq('')
|
205
|
-
expect(out.lines).to match(
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
210
|
+
expect(out.lines).to match(
|
211
|
+
[
|
212
|
+
"Only on local machine:\n",
|
213
|
+
a_string_matching(%r{ \+ \w .*routes/manyRoutes\.lua:4}),
|
214
|
+
"Nothing new remotely\n",
|
215
|
+
"Nothing that differs\n",
|
216
|
+
]
|
217
|
+
)
|
211
218
|
expect(status.exitstatus).to eq(0)
|
212
219
|
end
|
213
220
|
end
|
214
221
|
|
215
|
-
context
|
222
|
+
context 'with ProjectFile' do
|
216
223
|
before(:example) do
|
217
224
|
# We previously called syncdown, which created the project/services/
|
218
225
|
# directory, but don't fret, this copy command will overlay files and
|
@@ -227,7 +234,7 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
227
234
|
FileUtils.copy(File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml'), 'test.murano')
|
228
235
|
end
|
229
236
|
|
230
|
-
it
|
237
|
+
it 'status' do
|
231
238
|
out, err, status = Open3.capture3(capcmd('murano', 'status'))
|
232
239
|
expect(err).to eq('')
|
233
240
|
olines = out.lines
|
@@ -237,13 +244,15 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
237
244
|
expect(olines[13]).to eq("Nothing new remotely\n")
|
238
245
|
|
239
246
|
# NOTE: On Windows, touch doesn't work, so items differ.
|
240
|
-
# Check the platform, e.g.,
|
241
|
-
is_windows = (
|
242
|
-
|
247
|
+
# Check the platform, e.g., 'linux-gnu', or other.
|
248
|
+
#is_windows = (
|
249
|
+
# RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
250
|
+
#)
|
251
|
+
if OS.windows?
|
243
252
|
expect(olines[14]).to eq("Items that differ:\n")
|
244
253
|
expect(olines[15..16]).to include(
|
245
|
-
a_string_matching(
|
246
|
-
a_string_matching(
|
254
|
+
a_string_matching(%r{ M \w .*services/timer_timer\.lua}),
|
255
|
+
a_string_matching(%r{ M \w .*services/tsdb_exportJob\.lua}),
|
247
256
|
)
|
248
257
|
else
|
249
258
|
expect(olines[14]).to eq("Nothing that differs\n")
|
@@ -254,45 +263,47 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
254
263
|
end
|
255
264
|
|
256
265
|
# XXX wait, should a Solutionfile even work with Okami?
|
257
|
-
context
|
266
|
+
context 'with Solutionfile 0.2.0' do
|
258
267
|
before(:example) do
|
259
268
|
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
260
|
-
FileUtils.move('assets','files')
|
269
|
+
FileUtils.move('assets', 'files')
|
261
270
|
FileUtils.mkpath('specs')
|
262
|
-
FileUtils.copy(
|
263
|
-
'
|
271
|
+
FileUtils.copy(
|
272
|
+
File.join(@testdir, 'spec/fixtures/product_spec_files/lightbulb.yaml'),
|
273
|
+
'specs/resources.yaml'
|
274
|
+
)
|
264
275
|
File.open('Solutionfile.json', 'wb') do |io|
|
265
276
|
io << {
|
266
|
-
:
|
267
|
-
:
|
268
|
-
:
|
269
|
-
:
|
270
|
-
:
|
277
|
+
default_page: 'index.html',
|
278
|
+
file_dir: 'files',
|
279
|
+
custom_api: 'routes/manyRoutes.lua',
|
280
|
+
modules: {
|
281
|
+
table_util: 'modules/table_util.lua',
|
282
|
+
},
|
283
|
+
event_handler: {
|
284
|
+
device: {
|
285
|
+
datapoint: 'services/devdata.lua',
|
286
|
+
},
|
271
287
|
},
|
272
|
-
:event_handler => {
|
273
|
-
:device => {
|
274
|
-
:datapoint => 'services/devdata.lua'
|
275
|
-
}
|
276
|
-
}
|
277
288
|
}.to_json
|
278
289
|
end
|
279
290
|
end
|
280
291
|
|
281
|
-
it
|
292
|
+
it 'status' do
|
282
293
|
out, err, status = Open3.capture3(capcmd('murano', 'status'))
|
283
294
|
expect(err).to eq('')
|
284
295
|
# Not a single match, because the order of items within groups can shift
|
285
296
|
olines = out.lines
|
286
297
|
expect(olines[0]).to eq("Only on local machine:\n")
|
287
298
|
match_syncable_contents_resources(olines[1..4])
|
288
|
-
|
299
|
+
match_syncable_contents_except_single_route(olines[5..11])
|
289
300
|
#expect(olines[12]).to eq("Only on remote server:\n")
|
290
301
|
#match_remote_boilerplate_v1_0_0_service(olines[13..15])
|
291
302
|
expect(olines[12]).to eq("Nothing new remotely\n")
|
292
303
|
#expect(olines[16]).to eq("Nothing that differs\n")
|
293
304
|
##expect(olines[11]).to eq("Items that differ:\n")
|
294
305
|
##expect(olines[12..12]).to contain_exactly(
|
295
|
-
## a_string_matching(
|
306
|
+
## a_string_matching(%r{ M \w .*services/devdata\.lua}),
|
296
307
|
##)
|
297
308
|
expect(olines[13]).to eq("Items that differ:\n")
|
298
309
|
match_remote_boilerplate_v1_0_0_service(olines[14..16])
|
@@ -301,7 +312,7 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
301
312
|
end
|
302
313
|
|
303
314
|
# XXX wait, should a Solutionfile even work with Okami?
|
304
|
-
context
|
315
|
+
context 'with Solutionfile 0.3.0' do
|
305
316
|
before(:example) do
|
306
317
|
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
307
318
|
FileUtils.move('assets', 'files')
|
@@ -317,26 +328,26 @@ RSpec.describe 'murano status', :cmd, :needs_password do
|
|
317
328
|
routes: 'routes/manyRoutes.lua',
|
318
329
|
# Note that singleRoute.lua is not included, so it won't be seen by status command.
|
319
330
|
modules: {
|
320
|
-
table_util: 'modules/table_util.lua'
|
331
|
+
table_util: 'modules/table_util.lua',
|
321
332
|
},
|
322
333
|
services: {
|
323
334
|
device: {
|
324
|
-
datapoint: 'services/devdata.lua'
|
325
|
-
}
|
335
|
+
datapoint: 'services/devdata.lua',
|
336
|
+
},
|
326
337
|
},
|
327
338
|
version: '0.3.0',
|
328
339
|
}.to_json
|
329
340
|
end
|
330
341
|
end
|
331
342
|
|
332
|
-
it
|
343
|
+
it 'status' do
|
333
344
|
out, err, status = Open3.capture3(capcmd('murano', 'status'))
|
334
345
|
# pp out.split "\n"
|
335
346
|
expect(err).to eq('')
|
336
347
|
olines = out.lines
|
337
348
|
expect(olines[0]).to eq("Only on local machine:\n")
|
338
349
|
match_syncable_contents_resources(olines[1..4])
|
339
|
-
|
350
|
+
match_syncable_contents_except_single_route(olines[5..11])
|
340
351
|
#expect(olines[12]).to eq("Only on remote server:\n")
|
341
352
|
#match_remote_boilerplate_v1_0_0_service(olines[13..15])
|
342
353
|
expect(olines[12]).to eq("Nothing new remotely\n")
|