MuranoCLI 2.2.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.agignore +3 -0
- data/.gitignore +18 -1
- data/.rubocop.yml +222 -0
- data/.trustme.sh +185 -0
- data/.trustme.vim +24 -0
- data/Gemfile +23 -4
- data/LICENSE.txt +1 -1
- data/MuranoCLI.gemspec +43 -8
- data/README.markdown +9 -11
- data/Rakefile +187 -143
- data/TODO.taskpaper +2 -2
- data/bin/murano +51 -52
- data/docs/basic_example.rst +436 -0
- data/docs/completions/murano_completion-bash +3484 -0
- data/docs/demo.md +32 -32
- data/docs/develop.rst +391 -0
- data/lib/MrMurano.rb +21 -7
- data/lib/MrMurano/Account.rb +159 -174
- data/lib/MrMurano/Business.rb +381 -0
- data/lib/MrMurano/Config-Migrate.rb +32 -26
- data/lib/MrMurano/Config.rb +407 -128
- data/lib/MrMurano/Content.rb +191 -0
- data/lib/MrMurano/Gateway.rb +489 -0
- data/lib/MrMurano/Keystore.rb +48 -0
- data/lib/MrMurano/Passwords.rb +103 -0
- data/lib/MrMurano/ProjectFile.rb +121 -79
- data/lib/MrMurano/ReCommander.rb +114 -10
- data/lib/MrMurano/Setting.rb +90 -0
- data/lib/MrMurano/Solution-ServiceConfig.rb +89 -45
- data/lib/MrMurano/Solution-Services.rb +461 -166
- data/lib/MrMurano/Solution-Users.rb +70 -31
- data/lib/MrMurano/Solution.rb +372 -13
- data/lib/MrMurano/SolutionId.rb +73 -0
- data/lib/MrMurano/SyncRoot.rb +137 -0
- data/lib/MrMurano/SyncUpDown.rb +594 -284
- data/lib/MrMurano/Webservice-Cors.rb +71 -0
- data/lib/MrMurano/Webservice-Endpoint.rb +234 -0
- data/lib/MrMurano/Webservice-File.rb +193 -0
- data/lib/MrMurano/Webservice.rb +51 -0
- data/lib/MrMurano/commands.rb +18 -15
- data/lib/MrMurano/commands/business.rb +300 -6
- data/lib/MrMurano/commands/completion-bash.erb +166 -0
- data/lib/MrMurano/commands/{zshcomplete.erb → completion-zsh.erb} +0 -0
- data/lib/MrMurano/commands/completion.rb +76 -39
- data/lib/MrMurano/commands/config.rb +108 -44
- data/lib/MrMurano/commands/content.rb +115 -72
- data/lib/MrMurano/commands/cors.rb +29 -14
- data/lib/MrMurano/commands/devices.rb +286 -0
- data/lib/MrMurano/commands/domain.rb +52 -12
- data/lib/MrMurano/commands/gb.rb +24 -9
- data/lib/MrMurano/commands/globals.rb +64 -0
- data/lib/MrMurano/commands/init.rb +377 -155
- data/lib/MrMurano/commands/keystore.rb +92 -82
- data/lib/MrMurano/commands/link.rb +300 -0
- data/lib/MrMurano/commands/login.rb +74 -11
- data/lib/MrMurano/commands/logs.rb +63 -32
- data/lib/MrMurano/commands/mock.rb +57 -29
- data/lib/MrMurano/commands/password.rb +57 -39
- data/lib/MrMurano/commands/postgresql.rb +127 -94
- data/lib/MrMurano/commands/settings.rb +203 -0
- data/lib/MrMurano/commands/show.rb +79 -38
- data/lib/MrMurano/commands/solution.rb +423 -5
- data/lib/MrMurano/commands/solution_picker.rb +547 -0
- data/lib/MrMurano/commands/status.rb +195 -61
- data/lib/MrMurano/commands/sync.rb +78 -39
- data/lib/MrMurano/commands/timeseries.rb +71 -55
- data/lib/MrMurano/commands/tsdb.rb +113 -87
- data/lib/MrMurano/commands/usage.rb +57 -15
- data/lib/MrMurano/hash.rb +100 -10
- data/lib/MrMurano/http.rb +187 -43
- data/lib/MrMurano/makePretty.rb +16 -14
- data/lib/MrMurano/optparse.rb +2178 -0
- data/lib/MrMurano/progress.rb +138 -0
- data/lib/MrMurano/schema/resource-v1.0.0.yaml +32 -0
- data/lib/MrMurano/template/projectFile.murano.erb +16 -13
- data/lib/MrMurano/verbosing.rb +166 -29
- data/lib/MrMurano/version.rb +30 -1
- data/spec/Account-Passwords_spec.rb +21 -4
- data/spec/Account_spec.rb +69 -146
- data/spec/Business_spec.rb +290 -0
- data/spec/ConfigFile_spec.rb +1 -0
- data/spec/ConfigMigrate_spec.rb +12 -8
- data/spec/Config_spec.rb +40 -34
- data/spec/Content_spec.rb +363 -0
- data/spec/GatewayBase_spec.rb +54 -0
- data/spec/GatewayDevice_spec.rb +321 -0
- data/spec/GatewayResource_spec.rb +266 -0
- data/spec/GatewaySettings_spec.rb +120 -0
- data/spec/Http_spec.rb +18 -8
- data/spec/Mock_spec.rb +2 -2
- data/spec/ProjectFile_spec.rb +25 -14
- data/spec/Setting_spec.rb +110 -0
- data/spec/Solution-ServiceConfig_spec.rb +44 -5
- data/spec/Solution-ServiceEventHandler_spec.rb +23 -14
- data/spec/Solution-ServiceModules_spec.rb +47 -37
- data/spec/Solution-UsersRoles_spec.rb +10 -8
- data/spec/Solution_spec.rb +17 -8
- data/spec/SyncRoot_spec.rb +46 -20
- data/spec/SyncUpDown_spec.rb +437 -201
- data/spec/Verbosing_spec.rb +12 -4
- data/spec/{Solution-Cors_spec.rb → Webservice-Cors_spec.rb} +23 -20
- data/spec/{Solution-Endpoint_spec.rb → Webservice-Endpoint_spec.rb} +43 -41
- data/spec/{Solution-File_spec.rb → Webservice-File_spec.rb} +44 -33
- data/spec/Webservice-Setting_spec.rb +89 -0
- data/spec/_workspace.rb +4 -4
- data/spec/cmd_business_spec.rb +9 -4
- data/spec/cmd_common.rb +44 -1
- data/spec/cmd_content_spec.rb +43 -17
- data/spec/cmd_cors_spec.rb +4 -4
- data/spec/cmd_device_spec.rb +61 -16
- data/spec/cmd_domain_spec.rb +29 -6
- data/spec/cmd_init_spec.rb +281 -126
- data/spec/cmd_keystore_spec.rb +3 -3
- data/spec/cmd_link_spec.rb +98 -0
- data/spec/cmd_password_spec.rb +1 -1
- data/spec/cmd_setting_application_spec.rb +260 -0
- data/spec/cmd_setting_product_spec.rb +220 -0
- data/spec/cmd_status_spec.rb +223 -114
- data/spec/cmd_syncdown_spec.rb +115 -35
- data/spec/cmd_syncup_spec.rb +68 -15
- data/spec/cmd_usage_spec.rb +35 -8
- data/spec/fixtures/dumped_config +6 -4
- data/spec/fixtures/gateway_resource_files/resources.notyaml +12 -0
- data/spec/fixtures/gateway_resource_files/resources.yaml +13 -0
- data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +13 -0
- data/spec/fixtures/mrmuranorc_deleted_bob +0 -2
- data/spec/fixtures/product_spec_files/lightbulb.yaml +20 -13
- data/spec/fixtures/{syncable_content → syncable_conflict}/services/devdata.lua +1 -1
- data/spec/fixtures/{syncable_content → syncable_conflict}/services/timers.lua +0 -0
- data/spec/spec_helper.rb +5 -0
- metadata +262 -171
- data/bin/mr +0 -8
- data/lib/MrMurano/Product-1P-Device.rb +0 -145
- data/lib/MrMurano/Product-Resources.rb +0 -205
- data/lib/MrMurano/Product.rb +0 -358
- data/lib/MrMurano/Solution-Cors.rb +0 -47
- data/lib/MrMurano/Solution-Endpoint.rb +0 -191
- data/lib/MrMurano/Solution-File.rb +0 -166
- data/lib/MrMurano/commands/assign.rb +0 -57
- data/lib/MrMurano/commands/businessList.rb +0 -45
- data/lib/MrMurano/commands/product.rb +0 -14
- data/lib/MrMurano/commands/productCreate.rb +0 -39
- data/lib/MrMurano/commands/productDelete.rb +0 -33
- data/lib/MrMurano/commands/productDevice.rb +0 -87
- data/lib/MrMurano/commands/productDeviceIdCmds.rb +0 -89
- data/lib/MrMurano/commands/productList.rb +0 -45
- data/lib/MrMurano/commands/productWrite.rb +0 -27
- data/lib/MrMurano/commands/solutionCreate.rb +0 -41
- data/lib/MrMurano/commands/solutionDelete.rb +0 -34
- data/lib/MrMurano/commands/solutionList.rb +0 -45
- data/spec/ProductBase_spec.rb +0 -113
- data/spec/ProductContent_spec.rb +0 -162
- data/spec/ProductResources_spec.rb +0 -329
- data/spec/Product_1P_Device_spec.rb +0 -202
- data/spec/Product_1P_RPC_spec.rb +0 -175
- data/spec/Product_spec.rb +0 -153
- data/spec/Solution-ServiceDevice_spec.rb +0 -176
- data/spec/cmd_assign_spec.rb +0 -51
data/docs/demo.md
CHANGED
@@ -6,22 +6,22 @@
|
|
6
6
|
- Clone project: `git clone https://github.com/tadpol/GWE-Multitool.git demo01`
|
7
7
|
- `cd demo01`
|
8
8
|
|
9
|
-
- Pick a
|
10
|
-
- Set it: `
|
9
|
+
- Pick a business: `murano business list`
|
10
|
+
- Set it: `murano config business.id ZZZZZZZZZ`
|
11
11
|
|
12
|
-
- Create a product: `
|
13
|
-
- Save the result: `
|
12
|
+
- Create a product: `murano product create myawesomeproduct`
|
13
|
+
- Save the result: `murano config product.id YYYYYYYYY`
|
14
14
|
|
15
|
-
- Set the product definition: `
|
16
|
-
- Set the directory to look for specs. `
|
17
|
-
- Sync the product definition up: `
|
15
|
+
- Set the product definition: `murano config product.spec gwe-multitool.yaml`
|
16
|
+
- Set the directory to look for specs. `murano config location.specs spec`
|
17
|
+
- Sync the product definition up: `murano syncup -V --specs`
|
18
18
|
|
19
|
-
- Create
|
20
|
-
- Save the result: `
|
21
|
-
- Assign the product to the
|
19
|
+
- Create an application: `murano application create myawesomesolution`
|
20
|
+
- Save the result: `murano config application.id XXXXXX`
|
21
|
+
- Assign the product to the application: `murano assign set`
|
22
22
|
|
23
23
|
# What got configured?
|
24
|
-
`
|
24
|
+
`murano config --dump`
|
25
25
|
|
26
26
|
|
27
27
|
|
@@ -30,23 +30,23 @@
|
|
30
30
|
|
31
31
|
# <voice type='orc'>Work Work</voice>
|
32
32
|
|
33
|
-
- What is going to change? `
|
34
|
-
- Sync solution code up: `
|
33
|
+
- What is going to change? `murano status`
|
34
|
+
- Sync solution code up: `murano syncup -V`
|
35
35
|
|
36
36
|
- Change a file
|
37
|
-
- What is going to change? `
|
38
|
-
- Details of change: `
|
37
|
+
- What is going to change? `murano status`
|
38
|
+
- Details of change: `murano diff`
|
39
39
|
|
40
40
|
|
41
41
|
|
42
42
|
|
43
43
|
# Devices
|
44
|
-
- Add a real device: `
|
45
|
-
- !!!
|
46
|
-
- Which resources are there? `
|
44
|
+
- Add a real device: `murano product device enable 42:42:42:42:42:42`
|
45
|
+
- !!!cheat and activate by hand: `murano product device activate 42:42:42:42:42:42`
|
46
|
+
- Which resources are there? `murano pull --resources && cat specs/resources.yaml`
|
47
47
|
- What did the device write to that one resource?
|
48
|
-
`
|
49
|
-
- `
|
48
|
+
`murano product device read 42:42:42:42:42:42 update_interval`
|
49
|
+
- `murano product device write 42:42:42:42:42:42 update_interval 300`
|
50
50
|
|
51
51
|
|
52
52
|
|
@@ -71,8 +71,8 @@ See GWE.
|
|
71
71
|
# Debugging
|
72
72
|
|
73
73
|
## Logs
|
74
|
-
- `
|
75
|
-
- `
|
74
|
+
- `murano logs`
|
75
|
+
- `murano logs --follow`
|
76
76
|
|
77
77
|
|
78
78
|
|
@@ -81,29 +81,29 @@ See GWE.
|
|
81
81
|
|
82
82
|
## Keystore
|
83
83
|
### What is in the Keystore?
|
84
|
-
`
|
84
|
+
`murano keystore list`
|
85
85
|
|
86
86
|
### Write and Read a Key
|
87
|
-
- `
|
88
|
-
- `
|
87
|
+
- `murano keystore set test greebled`
|
88
|
+
- `murano keystore get test`
|
89
89
|
|
90
90
|
### Write to a Set
|
91
|
-
- `
|
91
|
+
- `murano keystore command sadd myset greebled`
|
92
92
|
Or any other supported Redis command.
|
93
93
|
|
94
94
|
### Remove just the ones with 'socketmap'
|
95
|
-
`
|
95
|
+
`murano keystore list | grep socketmap | xargs -L1 murano keystore delete`
|
96
96
|
|
97
97
|
|
98
98
|
|
99
99
|
|
100
100
|
## TSDB
|
101
101
|
|
102
|
-
- `
|
103
|
-
- `
|
104
|
-
- `
|
105
|
-
- `
|
106
|
-
- `
|
102
|
+
- `murano tsdb list metrics`
|
103
|
+
- `murano tsdb list tags`
|
104
|
+
- `murano tsdb query @sn=1 temp0`
|
105
|
+
- `murano tsdb query @sn=1 temp0 --limit=4`
|
106
|
+
- `murano tsdb query @sn=1 --limit=10 -c outformat=csv --epoch ms`
|
107
107
|
|
108
108
|
|
109
109
|
|
data/docs/develop.rst
ADDED
@@ -0,0 +1,391 @@
|
|
1
|
+
#########################
|
2
|
+
MuranoCLI Developer Guide
|
3
|
+
#########################
|
4
|
+
|
5
|
+
=========================
|
6
|
+
Introduction to MuranoCLI
|
7
|
+
=========================
|
8
|
+
|
9
|
+
Login example
|
10
|
+
-------------
|
11
|
+
|
12
|
+
Use MuranoCLI to logon for the first time.::
|
13
|
+
|
14
|
+
$ murano login
|
15
|
+
No Murano user account found; please login
|
16
|
+
User name: user@domain.tld
|
17
|
+
Couldn't find password for user@domain.tld
|
18
|
+
Password: XXXX
|
19
|
+
|
20
|
+
MuranoCLI creates two files in your home directory.::
|
21
|
+
|
22
|
+
$ cat ~/.murano/config
|
23
|
+
[user]
|
24
|
+
name = user@domain.tld
|
25
|
+
|
26
|
+
$ cat ~/.murano/passwords
|
27
|
+
---
|
28
|
+
bizapi.hosted.exosite.io:
|
29
|
+
user@domain.tld: "XXXXXXXXXXXXXXXX"
|
30
|
+
|
31
|
+
$ murano login --show-token
|
32
|
+
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
33
|
+
|
34
|
+
Create a business
|
35
|
+
-----------------
|
36
|
+
|
37
|
+
FIXME: Show the ``murano init`` command.
|
38
|
+
|
39
|
+
Work on a business
|
40
|
+
------------------
|
41
|
+
|
42
|
+
View a list of businesses you've created.::
|
43
|
+
|
44
|
+
$ murano business list
|
45
|
+
+------------------+-------+--------------------+
|
46
|
+
| bizid | role | name |
|
47
|
+
+------------------+-------+--------------------+
|
48
|
+
| abcdef1234567890 | owner | Business Name |
|
49
|
+
| 1234567890abcdef | admin | ACME IoT |
|
50
|
+
+------------------+-------+--------------------+
|
51
|
+
|
52
|
+
Pick a business to work on.::
|
53
|
+
|
54
|
+
# From the `murano business list` list:
|
55
|
+
$ murano config business.id abcdef1234567890
|
56
|
+
|
57
|
+
MuranoCLI will remember the business you've chosen.::
|
58
|
+
|
59
|
+
$ cat /exo/clients/exosite/.murano/config
|
60
|
+
[business]
|
61
|
+
id = ct7rmoz3hu34ygb9
|
62
|
+
|
63
|
+
MuranoCLI options
|
64
|
+
-----------------
|
65
|
+
|
66
|
+
To see all options that MuranoCLI *really* supports, make a dump.
|
67
|
+
|
68
|
+
.. code-block:: bash
|
69
|
+
|
70
|
+
$ murano config --dump
|
71
|
+
|
72
|
+
[tool]
|
73
|
+
verbose = false
|
74
|
+
debug = false
|
75
|
+
...
|
76
|
+
|
77
|
+
============================
|
78
|
+
Developer Setup Instructions
|
79
|
+
============================
|
80
|
+
|
81
|
+
Fork and clone the project
|
82
|
+
--------------------------
|
83
|
+
|
84
|
+
Fork the project into your account. Visit:
|
85
|
+
|
86
|
+
https://github.com/exosite/MuranoCLI.git
|
87
|
+
|
88
|
+
After forking, clone your repo and set its upstream.
|
89
|
+
|
90
|
+
NOTE: This guide assumes you are working out of the directory,
|
91
|
+
``/exo/clients/exosite``.
|
92
|
+
|
93
|
+
.. code-block:: bash
|
94
|
+
|
95
|
+
cd /exo/clients/exosite
|
96
|
+
|
97
|
+
git clone git@github.com:{username}/MuranoCLI.git
|
98
|
+
|
99
|
+
cd MuranoCLI
|
100
|
+
|
101
|
+
git remote add upstream git@github.com:exosite/MuranoCLI.git
|
102
|
+
# Add other developers' repos. E.g.,
|
103
|
+
git remote add tadpol git@github.com:tadpol/MuranoCLI.git
|
104
|
+
git remote add landonb git@github.com:landonb/MuranoCLI.git
|
105
|
+
|
106
|
+
Checkout a branch
|
107
|
+
-----------------
|
108
|
+
|
109
|
+
Checkout an existing branch...
|
110
|
+
|
111
|
+
.. code-block:: bash
|
112
|
+
|
113
|
+
git checkout feature/ticket_name_and_number
|
114
|
+
|
115
|
+
... or create a new branch.
|
116
|
+
|
117
|
+
.. code-block:: bash
|
118
|
+
|
119
|
+
# Create a new topic branch.
|
120
|
+
git checkout -b feature/totally_awesome
|
121
|
+
# Push the new topic branch and setup remote tracking [-u].
|
122
|
+
git push -u origin feature/totally_awesome
|
123
|
+
|
124
|
+
Rebase when merging co-workers' changes
|
125
|
+
---------------------------------------
|
126
|
+
|
127
|
+
While working on your branch, you'll want to periodically grab
|
128
|
+
changes from other folks. So long as you're the only one working
|
129
|
+
on your branch, rebase your work to keep the git history sane.
|
130
|
+
|
131
|
+
.. code-block:: bash
|
132
|
+
|
133
|
+
git fetch upstream
|
134
|
+
git checkout feature/murcli
|
135
|
+
git rebase upstream/feature/okami
|
136
|
+
git push origin feature/murcli
|
137
|
+
|
138
|
+
NOTE: Do not rebase onto a branch being actively worked on by
|
139
|
+
other people, like ``master`` or ``develop``, or you'll screw
|
140
|
+
up everybody's histories and force people to clone anew.
|
141
|
+
|
142
|
+
Beware of Ruby Version Management
|
143
|
+
---------------------------------
|
144
|
+
|
145
|
+
To build and run the code, you might be able to run whatever
|
146
|
+
ruby is currently installed. But you'll probably eventually
|
147
|
+
run into problems with different ruby projects using different
|
148
|
+
versions of different libraries. So you'll probably want to
|
149
|
+
use a ruby version manager, such as
|
150
|
+
`Ruby Version Manager <https://rvm.io/>`__,
|
151
|
+
or `chruby <https://github.com/postmodern/chruby>`__
|
152
|
+
or `rbenv <https://github.com/rbenv/rbenv>`__.
|
153
|
+
|
154
|
+
- If you're having problems building or running MuranoCLI,
|
155
|
+
``gem env`` is a good way to see how the ruby environment
|
156
|
+
variables are set.
|
157
|
+
|
158
|
+
- One important setting to check is the gem directory.
|
159
|
+
This should be somewhere writable by your user, like $HOME.
|
160
|
+
E.g.,
|
161
|
+
|
162
|
+
``$ ruby -rubygems -e 'puts Gem.user_dir'``
|
163
|
+
|
164
|
+
``/home/user/.gem/ruby/2.3.0``
|
165
|
+
|
166
|
+
- Other interesting environs:
|
167
|
+
|
168
|
+
``GEM_HOME``, ``GEM_PATH``, and ``GEM_ROOT``.
|
169
|
+
|
170
|
+
Example ``chruby`` usage
|
171
|
+
^^^^^^^^^^^^^^^^^^^^^^^^
|
172
|
+
|
173
|
+
If you use ``chruby``, tell it what version of ruby you want:
|
174
|
+
|
175
|
+
.. code-block:: bash
|
176
|
+
|
177
|
+
cd /exo/clients/exosite/MuranoCLI
|
178
|
+
echo "ruby-2.3" > .ruby-version
|
179
|
+
|
180
|
+
(You can also do this for ``rvm``, which recognizes the
|
181
|
+
same ``.ruby-version`` files.)
|
182
|
+
|
183
|
+
Now tell chruby to load the version of ruby you want:
|
184
|
+
|
185
|
+
.. code-block:: bash
|
186
|
+
|
187
|
+
cd /exo/clients/exosite/MuranoCLI
|
188
|
+
chruby $(cat .ruby-version)
|
189
|
+
|
190
|
+
Install dependencies
|
191
|
+
--------------------
|
192
|
+
|
193
|
+
To install the project, you'll need
|
194
|
+
`bundler
|
195
|
+
<https://github.com/bundler/bundler>`__.
|
196
|
+
|
197
|
+
Run these commands once from any directory:
|
198
|
+
|
199
|
+
.. code-block:: bash
|
200
|
+
|
201
|
+
gem install bundler
|
202
|
+
|
203
|
+
gem install rspec
|
204
|
+
|
205
|
+
gem install byebug
|
206
|
+
|
207
|
+
gem install rubocop
|
208
|
+
|
209
|
+
Prepare MuranoCLI
|
210
|
+
-----------------
|
211
|
+
|
212
|
+
Install the gems listed in the MuranoCLI Gemfile:
|
213
|
+
|
214
|
+
.. code-block:: bash
|
215
|
+
|
216
|
+
cd /exo/clients/exosite/MuranoCLI
|
217
|
+
bundle install --path $(ruby -rubygems -e 'puts Gem.dir') --with test
|
218
|
+
|
219
|
+
Build and Install MuranoCLI
|
220
|
+
---------------------------
|
221
|
+
|
222
|
+
Build and install the Gem locally to your local gem directory.
|
223
|
+
|
224
|
+
.. code-block:: bash
|
225
|
+
|
226
|
+
cd /exo/clients/exosite/MuranoCLI
|
227
|
+
|
228
|
+
rake install:user
|
229
|
+
|
230
|
+
Verify that it installed.
|
231
|
+
|
232
|
+
.. code-block:: bash
|
233
|
+
|
234
|
+
murano -v
|
235
|
+
|
236
|
+
Troubleshooting: check that ``murano`` doesn't reference something else.
|
237
|
+
|
238
|
+
.. code-block:: bash
|
239
|
+
|
240
|
+
command -v murano
|
241
|
+
|
242
|
+
Prepare to Test
|
243
|
+
---------------
|
244
|
+
|
245
|
+
Create Config File
|
246
|
+
^^^^^^^^^^^^^^^^^^
|
247
|
+
|
248
|
+
So the tests know what Business to use, setup a config file.
|
249
|
+
|
250
|
+
([lb] also likes to see what ``murano`` and ``curl`` calls happen,
|
251
|
+
so I enable ``curldebug`` and redirect the verbose output to a file,
|
252
|
+
``curlfile``.)
|
253
|
+
|
254
|
+
::
|
255
|
+
|
256
|
+
[user]
|
257
|
+
name = user@exosite.com
|
258
|
+
|
259
|
+
[net]
|
260
|
+
host = bizapi.hosted.exosite.io
|
261
|
+
|
262
|
+
[business]
|
263
|
+
id = xxxxxxxxxxxxxxxx
|
264
|
+
|
265
|
+
[tool]
|
266
|
+
#curldebug = false
|
267
|
+
curldebug = true
|
268
|
+
|
269
|
+
curlfile = "/exo/clients/exosite/MuranoCLI/curldebug.out"
|
270
|
+
|
271
|
+
Save the file outside the MuranoCLI repo, e.g., to
|
272
|
+
``/exo/clients/exosite/.murano.test``
|
273
|
+
|
274
|
+
Set Environs
|
275
|
+
^^^^^^^^^^^^
|
276
|
+
|
277
|
+
You'll need to setup a few environs first.
|
278
|
+
|
279
|
+
You could simply export the values explicitly::
|
280
|
+
|
281
|
+
export MURANO_CONFIGFILE="/exo/clients/exosite/.murano.test"
|
282
|
+
export MURANO_PASSWORD="XXXXXXXXXXXXXXXX"
|
283
|
+
|
284
|
+
Or you could do something fancier using MuranoCLI to find them, e.g.,::
|
285
|
+
|
286
|
+
cat > test-murano.sh << EOF
|
287
|
+
cat #!/bin/bash
|
288
|
+
export MURANO_CONFIGFILE="$(pwd)/.murano.test"
|
289
|
+
MURANO_USER=`murano password current`
|
290
|
+
MURANO_HOST=`murano config net.host`
|
291
|
+
export MURANO_PASSWORD=`ruby -ryaml -e "puts YAML.load_file(File.join(Dir.home,'.murano','passwords'))['$MURANO_HOST']['$MURANO_USER']"`
|
292
|
+
echo "Testing using ${MURANO_USER}@${MURANO_HOST} with PWD ${MURANO_PASSWORD} and CFG ${MURANO_CONFIGFILE}"
|
293
|
+
rspec "$@"
|
294
|
+
EOF
|
295
|
+
|
296
|
+
chmod 755 test-murano.sh
|
297
|
+
./test-murano.sh
|
298
|
+
|
299
|
+
Cleanup Solutions
|
300
|
+
^^^^^^^^^^^^^^^^^
|
301
|
+
|
302
|
+
Before running tests, or if tests are interrupted, delete all solutions
|
303
|
+
under your business.
|
304
|
+
|
305
|
+
.. code-block:: bash
|
306
|
+
|
307
|
+
cd /exo/clients/exosite/MuranoCLI
|
308
|
+
|
309
|
+
rake test_clean_up
|
310
|
+
|
311
|
+
Run Tests
|
312
|
+
---------
|
313
|
+
|
314
|
+
Run All Rspec Tests
|
315
|
+
^^^^^^^^^^^^^^^^^^^
|
316
|
+
|
317
|
+
.. code-block:: bash
|
318
|
+
|
319
|
+
rspec
|
320
|
+
|
321
|
+
Run Single Rspec Test
|
322
|
+
^^^^^^^^^^^^^^^^^^^^^
|
323
|
+
|
324
|
+
E.g.,
|
325
|
+
|
326
|
+
.. code-block:: bash
|
327
|
+
|
328
|
+
rspec ./spec/cmd_syncup_spec.rb
|
329
|
+
|
330
|
+
Run Tagged Rspec Test
|
331
|
+
^^^^^^^^^^^^^^^^^^^^^
|
332
|
+
|
333
|
+
The test might look like::
|
334
|
+
|
335
|
+
it "status", :not_in_okami do
|
336
|
+
|
337
|
+
And running it would look like::
|
338
|
+
|
339
|
+
rspec --tag '~not_in_okami' ./spec/cmd_syncup_spec.rb
|
340
|
+
|
341
|
+
Run Specific "Example" from Rspec Test
|
342
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
343
|
+
|
344
|
+
Run just one test within a file.
|
345
|
+
|
346
|
+
The test file might look like::
|
347
|
+
|
348
|
+
RSpec.describe 'murano status', :cmd, :needs_password do
|
349
|
+
...
|
350
|
+
context "with ProjectFile" do
|
351
|
+
...
|
352
|
+
it "status" do
|
353
|
+
...
|
354
|
+
|
355
|
+
And you could run just that test with::
|
356
|
+
|
357
|
+
rspec ./spec/cmd_status_spec.rb -e "murano status with ProjectFile status"
|
358
|
+
|
359
|
+
Run All Tests and Capture Colorful Output to HTML
|
360
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
361
|
+
|
362
|
+
.. code-block:: bash
|
363
|
+
|
364
|
+
sudo apt-get install aha
|
365
|
+
|
366
|
+
rspec --format html \
|
367
|
+
--out report/index-$( \
|
368
|
+
ruby -e 'require "/exo/clients/exosite/MuranoCLI/lib/MrMurano/version.rb"; \
|
369
|
+
puts MrMurano::VERSION').html
|
370
|
+
--format documentation \
|
371
|
+
--tag '~not_in_okami' \
|
372
|
+
| aha --black > MuranoCLI.rspec.html
|
373
|
+
|
374
|
+
Rerun Failing Tests
|
375
|
+
^^^^^^^^^^^^^^^^^^^
|
376
|
+
|
377
|
+
.. code-block:: bash
|
378
|
+
|
379
|
+
rspec --tag '~not_in_okami' --only-failures
|
380
|
+
|
381
|
+
Uninstall MuranoCLI
|
382
|
+
-------------------
|
383
|
+
|
384
|
+
E.g.,
|
385
|
+
|
386
|
+
.. code-block:: bash
|
387
|
+
|
388
|
+
gem uninstall MuranoCLI --version 3.0.0.alpha.2
|
389
|
+
|
390
|
+
gem uninstall MuranoCLI --version 2.2.4.alpha
|
391
|
+
|