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.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +10 -0
  3. data/MuranoCLI.gemspec +37 -6
  4. data/Rakefile +38 -11
  5. data/lib/MrMurano/commands/business.rb +0 -4
  6. data/lib/MrMurano/version.rb +1 -1
  7. metadata +2 -251
  8. data/dockers/Dockerfile.2.2.9 +0 -40
  9. data/dockers/Dockerfile.2.3.6 +0 -40
  10. data/dockers/Dockerfile.2.4.3 +0 -40
  11. data/dockers/Dockerfile.2.5.0 +0 -40
  12. data/dockers/Dockerfile.GemRelease +0 -49
  13. data/dockers/Dockerfile.m4 +0 -122
  14. data/dockers/README.rst +0 -362
  15. data/dockers/RELEASE.rst +0 -135
  16. data/dockers/docker-test.sh +0 -163
  17. data/dockers/gem-release.sh +0 -4
  18. data/docs/basic_example.rst +0 -436
  19. data/docs/ci/.trustme.plugin +0 -140
  20. data/docs/ci/.trustme.sh +0 -516
  21. data/docs/ci/.trustme.vim +0 -55
  22. data/docs/completions/murano_completion-bash +0 -4484
  23. data/docs/demo.md +0 -109
  24. data/docs/develop.rst +0 -392
  25. data/docs/release.rst +0 -295
  26. data/spec/Account-Passwords_spec.rb +0 -245
  27. data/spec/Account_spec.rb +0 -256
  28. data/spec/Business_spec.rb +0 -307
  29. data/spec/ConfigFile_spec.rb +0 -55
  30. data/spec/ConfigMigrate_spec.rb +0 -108
  31. data/spec/Config_spec.rb +0 -440
  32. data/spec/Content_spec.rb +0 -422
  33. data/spec/GatewayBase_spec.rb +0 -65
  34. data/spec/GatewayDevice_spec.rb +0 -403
  35. data/spec/GatewayResource_spec.rb +0 -283
  36. data/spec/GatewaySettings_spec.rb +0 -130
  37. data/spec/HttpAuthed_spec.rb +0 -87
  38. data/spec/Http_spec.rb +0 -220
  39. data/spec/MakePretties_spec.rb +0 -127
  40. data/spec/Mock_spec.rb +0 -62
  41. data/spec/ProjectFile_spec.rb +0 -381
  42. data/spec/Setting_spec.rb +0 -120
  43. data/spec/Solution-ServiceConfig_spec.rb +0 -272
  44. data/spec/Solution-ServiceEventHandler_spec.rb +0 -442
  45. data/spec/Solution-ServiceModules_spec.rb +0 -562
  46. data/spec/Solution-UsersRoles_spec.rb +0 -269
  47. data/spec/Solution_spec.rb +0 -140
  48. data/spec/SyncRoot_spec.rb +0 -111
  49. data/spec/SyncUpDown_spec.rb +0 -868
  50. data/spec/Verbosing_spec.rb +0 -332
  51. data/spec/Webservice-Cors_spec.rb +0 -225
  52. data/spec/Webservice-Endpoint_spec.rb +0 -650
  53. data/spec/Webservice-File_spec.rb +0 -282
  54. data/spec/Webservice-Setting_spec.rb +0 -105
  55. data/spec/_workspace.rb +0 -43
  56. data/spec/cmd_business_spec.rb +0 -64
  57. data/spec/cmd_common.rb +0 -507
  58. data/spec/cmd_config_spec.rb +0 -73
  59. data/spec/cmd_content_spec.rb +0 -109
  60. data/spec/cmd_cors_spec.rb +0 -54
  61. data/spec/cmd_device_spec.rb +0 -130
  62. data/spec/cmd_domain_spec.rb +0 -62
  63. data/spec/cmd_element_spec.rb +0 -401
  64. data/spec/cmd_exchange_spec.rb +0 -114
  65. data/spec/cmd_help_spec.rb +0 -72
  66. data/spec/cmd_init_spec.rb +0 -475
  67. data/spec/cmd_keystore_spec.rb +0 -97
  68. data/spec/cmd_link_spec.rb +0 -105
  69. data/spec/cmd_logs_spec.rb +0 -162
  70. data/spec/cmd_password_spec.rb +0 -64
  71. data/spec/cmd_setting_application_spec.rb +0 -300
  72. data/spec/cmd_setting_product_spec.rb +0 -246
  73. data/spec/cmd_status_spec.rb +0 -300
  74. data/spec/cmd_syncdown_application_spec.rb +0 -128
  75. data/spec/cmd_syncdown_both_spec.rb +0 -178
  76. data/spec/cmd_syncdown_unit_spec.rb +0 -861
  77. data/spec/cmd_syncup_spec.rb +0 -148
  78. data/spec/cmd_token_spec.rb +0 -53
  79. data/spec/cmd_usage_spec.rb +0 -79
  80. data/spec/dry_run_formatter.rb +0 -28
  81. data/spec/fixtures/.mrmuranorc +0 -9
  82. data/spec/fixtures/ProjectFiles/invalid.yaml +0 -9
  83. data/spec/fixtures/ProjectFiles/only_meta.yaml +0 -24
  84. data/spec/fixtures/ProjectFiles/with_routes.yaml +0 -27
  85. data/spec/fixtures/SolutionFiles/0.2.0.json +0 -20
  86. data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +0 -18
  87. data/spec/fixtures/SolutionFiles/0.2.json +0 -21
  88. data/spec/fixtures/SolutionFiles/0.3.0.json +0 -20
  89. data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +0 -19
  90. data/spec/fixtures/SolutionFiles/0.3.json +0 -20
  91. data/spec/fixtures/SolutionFiles/basic.json +0 -20
  92. data/spec/fixtures/SolutionFiles/secret.json +0 -6
  93. data/spec/fixtures/configfile +0 -9
  94. data/spec/fixtures/dumped_config +0 -57
  95. data/spec/fixtures/exchange_element/element-show.json +0 -1
  96. data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +0 -282
  97. data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +0 -588
  98. data/spec/fixtures/gateway_resource_files/resources.notyaml +0 -12
  99. data/spec/fixtures/gateway_resource_files/resources.yaml +0 -13
  100. data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +0 -13
  101. data/spec/fixtures/mrmuranorc_deleted_bob +0 -6
  102. data/spec/fixtures/mrmuranorc_tool_bob +0 -3
  103. data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +0 -116
  104. data/spec/fixtures/product_spec_files/example.murano.spec.yaml +0 -14
  105. data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +0 -21
  106. data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +0 -16
  107. data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +0 -11
  108. data/spec/fixtures/product_spec_files/lightbulb.yaml +0 -21
  109. data/spec/fixtures/roles-three.yaml +0 -11
  110. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +0 -98
  111. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +0 -98
  112. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +0 -98
  113. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +0 -98
  114. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +0 -72
  115. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +0 -98
  116. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +0 -98
  117. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +0 -98
  118. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +0 -98
  119. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +0 -98
  120. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +0 -98
  121. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +0 -98
  122. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +0 -98
  123. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +0 -98
  124. data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +0 -72
  125. data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +0 -72
  126. data/spec/fixtures/snapshots/murano business list as json.webmock +0 -27
  127. data/spec/fixtures/snapshots/murano business list as table.webmock +0 -27
  128. data/spec/fixtures/snapshots/murano business list fewer fields.webmock +0 -27
  129. data/spec/fixtures/snapshots/murano business list only ids.webmock +0 -27
  130. data/spec/fixtures/snapshots/murano business list output to file.webmock +0 -27
  131. data/spec/fixtures/snapshots/murano business without project help.webmock +0 -9
  132. data/spec/fixtures/snapshots/murano config Needs a key.webmock +0 -9
  133. data/spec/fixtures/snapshots/murano config Reads a key.webmock +0 -9
  134. data/spec/fixtures/snapshots/murano config Removes a key.webmock +0 -9
  135. data/spec/fixtures/snapshots/murano config Sets a key.webmock +0 -9
  136. data/spec/fixtures/snapshots/murano config Sets a user key.webmock +0 -9
  137. data/spec/fixtures/snapshots/murano content life cycle.webmock +0 -144
  138. data/spec/fixtures/snapshots/murano cors sets CORS.webmock +0 -78
  139. data/spec/fixtures/snapshots/murano cors show CORS.webmock +0 -64
  140. data/spec/fixtures/snapshots/murano device activates.webmock +0 -86
  141. data/spec/fixtures/snapshots/murano device enables a batch.webmock +0 -76
  142. data/spec/fixtures/snapshots/murano device enables and lists.webmock +0 -78
  143. data/spec/fixtures/snapshots/murano device writes and reads.webmock +0 -136
  144. data/spec/fixtures/snapshots/murano domain show domain.webmock +0 -101
  145. data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +0 -43
  146. data/spec/fixtures/snapshots/murano element show --help.webmock +0 -9
  147. data/spec/fixtures/snapshots/murano element show as csv.webmock +0 -43
  148. data/spec/fixtures/snapshots/murano element show as default-table.webmock +0 -43
  149. data/spec/fixtures/snapshots/murano element show as json.webmock +0 -43
  150. data/spec/fixtures/snapshots/murano element show as table truncate.webmock +0 -43
  151. data/spec/fixtures/snapshots/murano element show as table wrap.webmock +0 -43
  152. data/spec/fixtures/snapshots/murano element show as yaml.webmock +0 -43
  153. data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +0 -43
  154. data/spec/fixtures/snapshots/murano element without project usage.webmock +0 -9
  155. data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +0 -59
  156. data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +0 -59
  157. data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +0 -59
  158. data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +0 -59
  159. data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +0 -59
  160. data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +0 -83
  161. data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +0 -59
  162. data/spec/fixtures/snapshots/murano exchange without project help.webmock +0 -9
  163. data/spec/fixtures/snapshots/murano help using commander as --help.webmock +0 -9
  164. data/spec/fixtures/snapshots/murano help using commander no args.webmock +0 -9
  165. data/spec/fixtures/snapshots/murano help using subshell no args.webmock +0 -9
  166. data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +0 -9
  167. data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +0 -9
  168. data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +0 -201
  169. data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +0 -193
  170. data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +0 -213
  171. data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +0 -213
  172. data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +0 -213
  173. data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +0 -213
  174. data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +0 -108
  175. data/spec/fixtures/snapshots/murano keystore clearAll.webmock +0 -124
  176. data/spec/fixtures/snapshots/murano keystore deletes.webmock +0 -112
  177. data/spec/fixtures/snapshots/murano keystore gets.webmock +0 -96
  178. data/spec/fixtures/snapshots/murano keystore infos.webmock +0 -96
  179. data/spec/fixtures/snapshots/murano keystore lists.webmock +0 -96
  180. data/spec/fixtures/snapshots/murano link with project links and lists.webmock +0 -149
  181. data/spec/fixtures/snapshots/murano link with project unlinks.webmock +0 -165
  182. data/spec/fixtures/snapshots/murano link without project help.webmock +0 -9
  183. data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +0 -27
  184. data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +0 -27
  185. data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +0 -9
  186. data/spec/fixtures/snapshots/murano password Lists when no file.webmock +0 -9
  187. data/spec/fixtures/snapshots/murano password deletes a password.webmock +0 -9
  188. data/spec/fixtures/snapshots/murano password sets a password.webmock +0 -9
  189. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +0 -90
  190. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +0 -90
  191. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +0 -64
  192. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +0 -90
  193. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +0 -90
  194. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +0 -90
  195. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +0 -90
  196. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +0 -90
  197. data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +0 -322
  198. data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +0 -153
  199. data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +0 -153
  200. data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +0 -153
  201. data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +0 -153
  202. data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +0 -153
  203. data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +0 -153
  204. data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +0 -151
  205. data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +0 -479
  206. data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +0 -357
  207. data/spec/fixtures/snapshots/murano token with project list as table.webmock +0 -9
  208. data/spec/fixtures/snapshots/murano token without project help.webmock +0 -9
  209. data/spec/fixtures/snapshots/murano usage show usage.webmock +0 -93
  210. data/spec/fixtures/syncable_conflict/services/devdata.lua +0 -18
  211. data/spec/fixtures/syncable_conflict/services/timers.lua +0 -4
  212. data/spec/fixtures/syncable_content/assets/icon.png +0 -0
  213. data/spec/fixtures/syncable_content/assets/index.html +0 -0
  214. data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
  215. data/spec/fixtures/syncable_content/modules/table_util.lua +0 -58
  216. data/spec/fixtures/syncable_content/routes/manyRoutes.lua +0 -11
  217. data/spec/fixtures/syncable_content/routes/singleRoute.lua +0 -5
  218. data/spec/fixtures/websocket/README.rst +0 -110
  219. data/spec/fixtures/websocket/logs_blather.rb +0 -27
  220. data/spec/fixtures/websocket/logs_faker.rb +0 -153
  221. data/spec/fixtures/websocket/simple_connection.rb +0 -45
  222. data/spec/fixtures/websocket/simple_options.rb +0 -77
  223. data/spec/fixtures/websocket/simple_server.rb +0 -69
  224. data/spec/fixtures/websocket/wss-echo.rb +0 -48
  225. data/spec/fixtures/websocket/wss-fake-logs.rb +0 -20
  226. data/spec/spec_helper.rb +0 -131
  227. data/spec/variegated_TruthyFalsey_spec.rb +0 -29
  228. data/spec/webmock_snapshot.rb +0 -296
@@ -1,97 +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 keystore', :cmd, :needs_password do
14
- include_context 'CI_CMD'
15
-
16
- before(:example) do
17
- murano_solutions_expunge_yes
18
-
19
- @product_name = @snapshotter.resolve_var(
20
- 'product.name', rname('keystoreTest')
21
- )
22
- out, err = murano_command_run(
23
- 'solution create', '--type', 'application', @product_name, '--save',
24
- )
25
- expect(err).to eq('')
26
- expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
27
-
28
- out, err = murano_command_run(
29
- 'keystore set', 'bob', 'built',
30
- )
31
- expect(out.chomp).to eq('')
32
- expect(err).to eq('')
33
- end
34
-
35
- after(:example) do
36
- out, err = murano_command_run('solution delete', @product_name, '-y')
37
- expect(out).to eq('')
38
- expect(err).to eq('')
39
- end
40
-
41
- it 'gets' do
42
- out, err = murano_command_run('keystore get', 'bob')
43
- expect(out.chomp).to eq('built')
44
- expect(err).to eq('')
45
- end
46
-
47
- it 'lists' do
48
- out, err = murano_command_run('keystore list')
49
- expect(out.chomp).to eq('bob')
50
- expect(err).to eq('')
51
- end
52
-
53
- it 'infos' do
54
- out, err = murano_command_run('keystore info', '-c', 'outformat=json')
55
- expect { out = JSON.parse(out) }.to_not raise_error
56
- expect(err).to eq('')
57
- expect(out).to match(
58
- 'quota' => { 'keys' => a_kind_of(Integer) },
59
- 'usage' => { 'keys' => 1, 'size' => a_kind_of(Integer) },
60
- )
61
- end
62
-
63
- it 'deletes', :club_10s do
64
- out, err = murano_command_run('keystore delete', 'bob')
65
- expect(out.chomp).to eq('')
66
- expect(err).to eq('')
67
-
68
- out, err = murano_command_run('keystore list')
69
- expect(out.chomp).to eq('')
70
- expect(err).to eq('')
71
- end
72
-
73
- it 'clearAll', :club_10s do
74
- out, err = murano_command_run('keystore set', 'another', 'value')
75
- expect(out.chomp).to eq('')
76
- expect(err).to eq('')
77
-
78
- out, err = murano_command_run('keystore clearAll')
79
- expect(out.chomp).to eq('')
80
- expect(err).to eq('')
81
-
82
- out, err = murano_command_run('keystore list')
83
- expect(out.chomp).to eq('')
84
- expect(err).to eq('')
85
- end
86
-
87
- it 'can call other commands', :club_10s do
88
- out, err = murano_command_run('keystore command', 'lpush', 'another', 'value')
89
- expect(out.chomp).to eq('1')
90
- expect(err).to eq('')
91
-
92
- out, err = murano_command_run('keystore command', 'rpop', 'another')
93
- expect(out.chomp).to eq('value')
94
- expect(err).to eq('')
95
- end
96
- end
97
-
@@ -1,105 +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
-
11
- require 'cmd_common'
12
- require 'MrMurano/Config'
13
- require 'MrMurano/progress'
14
- require 'MrMurano/commands/link'
15
-
16
- RSpec.describe 'murano link', :cmd, :needs_password do
17
- include_context 'CI_CMD'
18
-
19
- context 'without project' do
20
- it 'help' do
21
- cmd_verify_help('link')
22
- end
23
-
24
- # 2017-08-30: The next two tests show the difference between using a
25
- # subshell to run murano commands versus running them directly. The
26
- # latter method lets us get coverage of the command modules.
27
- context 'subshell vs inline' do
28
- context 'using subshell' do
29
- it 'will not list' do
30
- out, err = murano_command_exits('link list')
31
- expect(out).to eq('')
32
- expecting = %(No applications found\nNo service links found\n)
33
- expect(MrMurano::Progress.strip_color(err)).to eq(expecting)
34
- end
35
- end
36
-
37
- context 'using commander' do
38
- it 'will not list' do
39
- # Because we run from the context of the rspec command, the :env
40
- # config file will have loaded, so business.id will not be set.
41
- _stdout, stderr = murano_command_exits('link list')
42
- expect(stderr).to eq(
43
- %(No applications found\nNo service links found\n)
44
- )
45
- end
46
- end
47
- end
48
- end
49
-
50
- context 'with project' do
51
- before(:example) do
52
- project_up(skip_link: true)
53
- end
54
-
55
- after(:example) do
56
- project_down
57
- end
58
-
59
- it 'links and lists', :club_20s, :club_10s do
60
- out, err = murano_command_run('assign set')
61
- olines = out.lines
62
- expect(strip_fancy(olines[0])).to eq(
63
- "Linked '#{@proj_name_prod}' to '#{@proj_name_appy}'\n"
64
- )
65
- expect(olines[1]).to eq("Created default event handler\n")
66
- expect(err).to eq('')
67
-
68
- out, err = murano_command_run('assign list')
69
- expect(err).to eq('')
70
- olines = out.lines
71
- expect(olines[0]).to match(/^(\+-+){3}\+$/)
72
- expect(olines[1]).to match(/^\| name\s+\| script_key\s+\| service\s+\|$/)
73
- expect(olines[2]).to match(/^(\+-+){3}\+$/)
74
- expect(olines[-1]).to match(/^(\+-+){3}\+$/)
75
- end
76
-
77
- it 'unlinks', :club_20s, :club_10s do
78
- out, err = murano_command_run('assign set')
79
- #expect(out).to a_string_starting_with("Linked product #{@solz_name}")
80
- olines = out.lines
81
- expect(strip_fancy(olines[0])).to eq(
82
- "Linked '#{@proj_name_prod}' to '#{@proj_name_appy}'\n"
83
- )
84
- expect(olines[1]).to eq("Created default event handler\n")
85
- expect(err).to eq('')
86
-
87
- out, err = murano_command_run('link unset')
88
- #expect(out).to a_string_starting_with("Unlinked #{@solz_name}")
89
- # E.g.,
90
- # Unlinked ‘linktest3e7def1b86a1d680’ from ‘linktest3e7def1b86a1d680’\n
91
- # Removed ‘h2thqll2z9sqoooc0_w4w3vxla11ngg4cok_event’
92
- # from ‘linktest3e7def1b86a1d680\n
93
- olines = out.lines
94
- expect(strip_fancy(olines[0])).to eq(
95
- "Unlinked '#{@proj_name_prod}' from '#{@proj_name_appy}'\n"
96
- )
97
- expect(strip_fancy(olines[1])).to a_string_starting_with(%(Removed '))
98
- expect(strip_fancy(olines[1])).to match(
99
- /^Removed '[_a-z0-9]*' from '#{@proj_name_appy}'\n$/
100
- )
101
- expect(err).to eq('')
102
- end
103
- end
104
- end
105
-
@@ -1,162 +0,0 @@
1
- # Copyright © 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 'json'
9
- require 'open3'
10
- require 'socket'
11
- require 'timeout'
12
- require 'uri'
13
-
14
- require 'MrMurano/Config'
15
- require 'cmd_common'
16
- require 'fixtures/websocket/simple_server'
17
- require 'fixtures/websocket/logs_faker'
18
-
19
- RSpec.describe 'murano logs', :cmd, :needs_password do
20
- include_context 'CI_CMD'
21
-
22
- before(:example) do
23
- @port = SimpleWebSocket::Server::DEFAULT_WS_PORT
24
- @port_s = @port && ":#{@port}" || ''
25
-
26
- # CI_CMD's before() creates a new Config and calls load().
27
- # We just need to add a few things.
28
- $cfg.set('net.host', "127.0.0.1#{@port_s}", :project)
29
- $cfg.set('net.protocol', 'http', :project)
30
- $cfg.set('application.id', 'XYZ', :project)
31
-
32
- @acc = MrMurano::Account.new
33
- allow(@acc).to receive(:login_info).and_return(email: 'bob', password: 'v')
34
- end
35
-
36
- # FIXME: (landonb): MUR-3081: Remove old http code for v3.1.0. Search: LOGS_USE_HTTP.
37
- def supports_ws?
38
- runner = ::Commander::Runner.instance
39
- logs_cmd = runner.command(:logs)
40
- logs_cmd.options.any? do |opt|
41
- opt[:args].include? '--http'
42
- end
43
- end
44
-
45
- def test_tail_log
46
- stub_request_token
47
- spawn_websocket_server
48
- spawn_logs_stream_test_simple
49
- run_logs_tail
50
- wait_websocket_server
51
- expect_output
52
- end
53
-
54
- def stub_request_token
55
- stub_request(:post, "http://127.0.0.1#{@port_s}/api:1/token/")
56
- .with(
57
- body: '{"email":"bob","password":"v"}',
58
- headers: {
59
- 'Accept' => '*/*',
60
- 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
61
- 'Content-Type' => 'application/json',
62
- # 'Host'=>'ABC',
63
- 'Host' => "127.0.0.1#{@port_s}",
64
- 'User-Agent' => 'MrMurano/3.0.7',
65
- }
66
- )
67
- .to_return(
68
- status: 200, body: { token: 'ABCDEFGHIJKLMNOP' }.to_json, headers: {}
69
- )
70
- end
71
-
72
- def spawn_websocket_server
73
- ws_svr = "#{File.dirname(__FILE__)}/fixtures/websocket/wss-echo.rb"
74
- @wss_in, @wss_out, @wss_err, @wss_thr = Open3.popen3(ws_svr.to_s)
75
- @wss_out.close
76
- @wss_err.close
77
- await_websocket_server!
78
- end
79
-
80
- def await_websocket_server!
81
- # Wait for the server to start, or the logs command will fail to connect.
82
- ready = false
83
- 5.times do
84
- begin
85
- s = TCPSocket.new('127.0.0.1', @port)
86
- s.close
87
- ready = true
88
- break
89
- # rubocop:disable Lint/HandleExceptions: Do not suppress exceptions.
90
- rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
91
- # pass
92
- end
93
- sleep 0.2
94
- end
95
- raise 'Server never started!' unless ready
96
- end
97
-
98
- def spawn_logs_stream_test_simple
99
- Thread.abort_on_exception = true
100
- @svr_thd = Thread.new { logs_stream_test_simple }
101
- end
102
-
103
- def logs_stream_test_simple
104
- sleep 0.1 until EM.reactor_running?
105
- @blatherer = LogsFaker.new
106
- sleep 0.1
107
- @wss_in.puts JSON.generate(@blatherer.example_type_script)
108
- sleep 0.1
109
- @wss_in.puts JSON.generate(@blatherer.example_type_call)
110
- sleep 0.1
111
- @wss_in.puts JSON.generate(@blatherer.example_type_event)
112
- sleep 0.1
113
- @wss_in.puts JSON.generate(@blatherer.example_type_config_device_v1)
114
- sleep 0.1
115
- @wss_in.puts JSON.generate(@blatherer.example_type_config_null)
116
- sleep 0.1
117
- @wss_in.puts JSON.generate(@blatherer.example_type_config_newservice)
118
- sleep 0.1
119
- @wss_in.puts 'EXIT'
120
- @wss_in.close
121
- end
122
-
123
- def run_logs_tail
124
- # For coverage, we have to call the command directly.
125
- #
126
- # DEVs: Run this is you want stdout to flow to the terminal
127
- # (to make developing easier):
128
- #
129
- # runner = ::Commander::Runner.instance
130
- # logs_cmd = runner.command(:logs)
131
- # mrcmd = logs_cmd.run('-f')
132
- #
133
- # Normally, we instead capture stdout so we can expect() it.
134
- @cmd_out, @cmd_err = murano_command_run('logs', '-f')
135
- end
136
-
137
- def wait_websocket_server
138
- # Block 'til subprocess exits. Receives a Process::Status.
139
- _proc_status = @wss_thr.value
140
- end
141
-
142
- def expect_output
143
- expect(@cmd_err).to eq(%(WebSocket closed [1006]\n))
144
- expect(@cmd_out).to eq(
145
- %(
146
- message: #{JSON.generate(@blatherer.example_type_script)}
147
- message: #{JSON.generate(@blatherer.example_type_call)}
148
- message: #{JSON.generate(@blatherer.example_type_event)}
149
- message: #{JSON.generate(@blatherer.example_type_config_device_v1)}
150
- message: #{JSON.generate(@blatherer.example_type_config_null)}
151
- message: #{JSON.generate(@blatherer.example_type_config_newservice)}
152
- ).strip + "\n"
153
- )
154
- end
155
-
156
- context 'when project is setup' do
157
- it 'tail log' do
158
- test_tail_log if supports_ws?
159
- end
160
- end
161
- end
162
-
@@ -1,64 +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 password', :cmd do
13
- include_context 'CI_CMD'
14
-
15
- it 'Lists when no file' do
16
- out, err = murano_command_run('password list')
17
- expect(err).to eq('')
18
- olines = out.lines
19
- expect(olines[0]).to match(/^(\+-+){2}\+$/)
20
- expect(olines[1]).to match(/^\| Host\s+\| Username\s+\|$/)
21
- expect(olines[2]).to match(/^(\+-+){2}\+$/)
22
- end
23
-
24
- it 'sets a password' do
25
- out, err = murano_command_run(
26
- 'password set', 'bob@bob.bob', 'an.API.host.i', '--password', 'bad',
27
- )
28
- expect(err).to eq('')
29
- expect(out).to eq('')
30
-
31
- out, err = murano_command_run('password list')
32
- expect(err).to eq('')
33
- olines = out.lines
34
- expect(olines[0]).to match(/^(\+-+){2}\+$/)
35
- expect(olines[1]).to match(/^\| Host\s+\| Username\s+\|$/)
36
- expect(olines[2]).to match(/^(\+-+){2}\+$/)
37
- expect(olines[3]).to match(/^\| an.API.host.i\s+\| bob@bob\.bob\s+\|$/)
38
- expect(olines[4]).to match(/^(\+-+){2}\+$/)
39
- end
40
-
41
- it 'deletes a password' do
42
- File.open(File.join(ENV['HOME'], '.murano', 'passwords'), 'w') do |io|
43
- io << "---\n"
44
- io << "an.API.host.i:\n"
45
- io << " bob@bob.bob: badpassword\n"
46
- io << " rich@er.u: notbetter\n"
47
- end
48
- out, err = murano_command_run(
49
- 'password delete', 'rich@er.u', 'an.API.host.i', '-y',
50
- )
51
- expect(err).to eq('')
52
- expect(out).to eq('')
53
-
54
- out, err = murano_command_run('password list')
55
- expect(err).to eq('')
56
- olines = out.lines
57
- expect(olines[0]).to match(/^(\+-+){2}\+$/)
58
- expect(olines[1]).to match(/^\| Host\s+\| Username\s+\|$/)
59
- expect(olines[2]).to match(/^(\+-+){2}\+$/)
60
- expect(olines[3]).to match(/^\| an.API.host.i\s+\| bob@bob\.bob\s+\|$/)
61
- expect(olines[4]).to match(/^(\+-+){2}\+$/)
62
- end
63
- end
64
-
@@ -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 'vine'
12
- require 'cmd_common'
13
-
14
- RSpec.describe 'murano application setting', :cmd, :needs_password do
15
- include_context 'CI_CMD'
16
-
17
- before(:example) do
18
- murano_solutions_expunge_yes
19
-
20
- @product_name = @snapshotter.resolve_var(
21
- 'product.name', rname('settingtest')
22
- )
23
- out, err = murano_command_run(
24
- 'solution create', '--type', 'application', @product_name, '--save',
25
- )
26
- expect(err).to eq('')
27
- expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
28
- end
29
-
30
- after(:example) do
31
- out, err = murano_command_run('solution delete', @product_name, '-y')
32
- expect(out).to eq('')
33
- expect(err).to eq('')
34
- end
35
-
36
- it 'reads Webservice.cors' do
37
- out, err = murano_command_run(
38
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
39
- )
40
- expect { JSON.parse(out) }.to_not raise_error
41
- expect(err).to eq('')
42
- end
43
-
44
- it 'reads Webservice.cors to a file' do
45
- out, err = murano_command_run(
46
- 'setting read', 'Webservice.cors', '-o', 'testout', '-c', 'outformat=json',
47
- )
48
- expect(err).to eq('')
49
- expect(out).to eq('')
50
- expect(File.exist?('testout')).to be true
51
- end
52
-
53
- context 'Writes (using Webservice.cors)' do
54
- before(:example) do
55
- out, err = murano_command_run(
56
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
57
- )
58
- expect { @json_before = JSON.parse(out) }.to_not raise_error
59
- expect(err).to eq('')
60
- end
61
- # {'origin'=>true,
62
- # 'methods'=>['HEAD', 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
63
- # 'headers'=>['Content-Type', 'Cookie', 'Authorization'],
64
- # 'credentials'=>true}
65
-
66
- context 'a bool value' do
67
- it 'Yes', :club_10s do
68
- out, err = murano_command_run(
69
- 'setting write', 'Webservice.cors', 'origin', '--bool', 'Yes',
70
- )
71
- expect(err).to eq('')
72
- expect(out).to eq('')
73
-
74
- out, err = murano_command_run(
75
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
76
- )
77
- json_after = nil
78
- expect { json_after = JSON.parse(out) }.to_not raise_error
79
- expect(err).to eq('')
80
- @json_before['origin'] = true
81
- expect(json_after).to match(@json_before)
82
- end
83
-
84
- it 'true', :club_10s do
85
- out, err = murano_command_run(
86
- 'setting write', 'Webservice.cors', 'origin', '--bool', 'true',
87
- )
88
- expect(err).to eq('')
89
- expect(out).to eq('')
90
-
91
- out, err = murano_command_run(
92
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
93
- )
94
- json_after = nil
95
- expect { json_after = JSON.parse(out) }.to_not raise_error
96
- expect(err).to eq('')
97
- @json_before['origin'] = true
98
- expect(json_after).to match(@json_before)
99
- end
100
-
101
- it 'on', :club_30s, :club_20s, :club_10s do
102
- out, err = murano_command_run(
103
- 'setting write', 'Webservice.cors', 'origin', '--bool', 'on',
104
- )
105
- expect(err).to eq('')
106
- expect(out).to eq('')
107
-
108
- out, err = murano_command_run(
109
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
110
- )
111
- json_after = nil
112
- expect { json_after = JSON.parse(out) }.to_not raise_error
113
- expect(err).to eq('')
114
- @json_before['origin'] = true
115
- expect(json_after).to match(@json_before)
116
- end
117
-
118
- it '1', :club_10s do
119
- out, err = murano_command_run(
120
- 'setting write', 'Webservice.cors', 'origin', '--bool', '1',
121
- )
122
- expect(err).to eq('')
123
- expect(out).to eq('')
124
-
125
- out, err = murano_command_run(
126
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
127
- )
128
- json_after = nil
129
- expect { json_after = JSON.parse(out) }.to_not raise_error
130
- expect(err).to eq('')
131
- @json_before['origin'] = true
132
- expect(json_after).to match(@json_before)
133
- end
134
-
135
- it 'bob', :club_10s do
136
- out, err = murano_command_exits(
137
- 'setting write', 'Webservice.cors', 'origin', '--bool', 'bob',
138
- )
139
- expect(err).to eq("Value \"bob\" is not a bool type!\n")
140
- expect(out).to eq('')
141
- end
142
-
143
- it 'No', :club_10s do
144
- out, err = murano_command_run(
145
- 'setting write', 'Webservice.cors', 'origin', '--bool', 'No',
146
- )
147
- expect(err).to eq('')
148
- expect(out).to eq('')
149
-
150
- out, err = murano_command_run(
151
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
152
- )
153
- json_after = nil
154
- expect { json_after = JSON.parse(out) }.to_not raise_error
155
- expect(err).to eq('')
156
- @json_before['origin'] = false
157
- expect(json_after).to match(@json_before)
158
- end
159
-
160
- it 'false', :club_10s do
161
- out, err = murano_command_run(
162
- 'setting write', 'Webservice.cors', 'origin', '--bool', 'false',
163
- )
164
- expect(err).to eq('')
165
- expect(out).to eq('')
166
-
167
- out, err = murano_command_run(
168
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
169
- )
170
- json_after = nil
171
- expect { json_after = JSON.parse(out) }.to_not raise_error
172
- expect(err).to eq('')
173
- @json_before['origin'] = false
174
- expect(json_after).to match(@json_before)
175
- end
176
-
177
- it 'off', :club_10s do
178
- out, err = murano_command_run(
179
- 'setting write', 'Webservice.cors', 'origin', '--bool', 'Off',
180
- )
181
- expect(err).to eq('')
182
- expect(out).to eq('')
183
-
184
- out, err = murano_command_run(
185
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
186
- )
187
- json_after = nil
188
- expect { json_after = JSON.parse(out) }.to_not raise_error
189
- expect(err).to eq('')
190
- @json_before['origin'] = false
191
- expect(json_after).to match(@json_before)
192
- end
193
-
194
- it '0', :club_30s, :club_20s, :club_10s do
195
- out, err = murano_command_run(
196
- 'setting write', 'Webservice.cors', 'origin', '--bool', '0',
197
- )
198
- expect(err).to eq('')
199
- expect(out).to eq('')
200
-
201
- out, err = murano_command_run(
202
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
203
- )
204
- json_after = nil
205
- expect { json_after = JSON.parse(out) }.to_not raise_error
206
- expect(err).to eq('')
207
- @json_before['origin'] = false
208
- expect(json_after).to match(@json_before)
209
- end
210
-
211
- it 'on STDIN', :club_10s do
212
- out, err = murano_command_run(
213
- 'setting write', 'Webservice.cors', 'origin', '--bool',
214
- stdin_data: 'true',
215
- )
216
- expect(err).to eq('')
217
- expect(out).to eq('')
218
-
219
- out, err = murano_command_run(
220
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
221
- )
222
- json_after = nil
223
- expect { json_after = JSON.parse(out) }.to_not raise_error
224
- expect(err).to eq('')
225
- @json_before['origin'] = true
226
- expect(json_after).to match(@json_before)
227
- end
228
- end
229
-
230
- it 'a json array blob', :club_10s do
231
- out, err = murano_command_run(
232
- 'setting write', 'Webservice.cors', 'headers', '--json', '--', '["fidget", "forgotten", "tokens"]',
233
- )
234
- expect(err).to eq('')
235
- expect(out).to eq('')
236
-
237
- out, err = murano_command_run(
238
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
239
- )
240
- json_after = nil
241
- expect { json_after = JSON.parse(out) }.to_not raise_error
242
- expect(err).to eq('')
243
- @json_before['headers'] = %w[fidget forgotten tokens]
244
- expect(json_after).to match(@json_before)
245
- end
246
-
247
- it 'a json array blob with STDIN', :club_10s do
248
- out, err = murano_command_run(
249
- 'setting write', 'Webservice.cors', 'headers', '--json',
250
- stdin_data: '["fidget", "forgotten", "tokens"]',
251
- )
252
- expect(err).to eq('')
253
- expect(out).to eq('')
254
-
255
- out, err = murano_command_run(
256
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
257
- )
258
- json_after = nil
259
- expect { json_after = JSON.parse(out) }.to_not raise_error
260
- expect(err).to eq('')
261
- @json_before['headers'] = %w[fidget forgotten tokens]
262
- expect(json_after).to match(@json_before)
263
- end
264
-
265
- it 'an array', :club_10s do
266
- out, err = murano_command_run(
267
- 'setting write', 'Webservice.cors', 'headers', '--array', 'fidget', 'forgotten', 'tokens',
268
- )
269
- expect(err).to eq('')
270
- expect(out).to eq('')
271
-
272
- out, err = murano_command_run(
273
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
274
- )
275
- json_after = nil
276
- expect { json_after = JSON.parse(out) }.to_not raise_error
277
- expect(err).to eq('')
278
- @json_before['headers'] = %w[fidget forgotten tokens]
279
- expect(json_after).to match(@json_before)
280
- end
281
-
282
- it 'appends an array', :club_10s do
283
- out, err = murano_command_run(
284
- 'setting write', 'Webservice.cors', 'headers', '--array', '--append', 'fidget', 'forgotten', 'tokens',
285
- )
286
- expect(err).to eq('')
287
- expect(out).to eq('')
288
-
289
- out, err = murano_command_run(
290
- 'setting read', 'Webservice.cors', '-c', 'outformat=json',
291
- )
292
- json_after = nil
293
- expect { json_after = JSON.parse(out) }.to_not raise_error
294
- expect(err).to eq('')
295
- @json_before['headers'] = @json_before['headers'] + %w[fidget forgotten tokens]
296
- expect(json_after).to match(@json_before)
297
- end
298
- end
299
- end
300
-