mutx 0.1.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cd516b2fbfcac06cbc311d2dc3ef1bfc04551fdb
4
+ data.tar.gz: 715c7e97c93571caddb1636ac0d96703b7a546ca
5
+ SHA512:
6
+ metadata.gz: 4d9356515d7c17cb6bd559b97a242bb22ace7f9117888e181f21010f75e48f8777d0166b0fa96afbc34b0cd2224f6297789d5d619d98c5159b6f8c6851587d88
7
+ data.tar.gz: 41fe84a5bb8daa2d2e2aa5e2499ac21dc53c1abc298b38e3685b50f7ad92265be1811399b56a8bd68009e5ad4afed5a9cd0408ec5be0b1700a4bb6dcc4a7a01e
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ pkg
2
+ Gemfile.lock
3
+ mutx/
4
+ mutx/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'mutx', path: '~/Desktop/mutx'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Roman Rodriguez
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,259 @@
1
+ Mutx (WIP)
2
+ ==============
3
+
4
+
5
+ #### *This project was created in order to expose tasks (tests) easily so anybody is allowed to execute them.*
6
+
7
+ (NOT READY YET)
8
+
9
+ ONLY FOR UBUNTU (By Now)
10
+
11
+ Before installing Mutx you should have installed:
12
+
13
+ - MongoDb (version >= 2.6) See http://www.mongodb.org/downloads
14
+
15
+ $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
16
+
17
+ $ sudo apt-get update
18
+
19
+ $ sudo apt-get install mongodb
20
+
21
+ $ sudo service mongodb start
22
+
23
+ - Redis (http://tosbourn.com/install-latest-version-redis-ubuntu/)
24
+
25
+ $ sudo apt-get install -y python-software-properties
26
+
27
+ $ sudo add-apt-repository -y ppa:rwky/redis
28
+
29
+ $ sudo apt-get update
30
+
31
+ $ sudo apt-get install -y redis-server
32
+
33
+ - If you want to run GUI tests using WebDriver in headless mode you should install xvfb package
34
+
35
+ $sudo apt-get intall xvfb
36
+
37
+ - While running in headless mode you may face an error like:
38
+ LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Error spawning command line `dbus-launch --autolaunch
39
+ This coulb be solved by installing dbus-x11 package
40
+
41
+ $apt-get install dbus-x11
42
+
43
+
44
+
45
+ ## Mutx Installation
46
+
47
+ $ gem install mutx
48
+
49
+ ## Usage
50
+
51
+ Go to your project folder and run install command to use mutx over your project
52
+
53
+ $ mutx install
54
+
55
+ Then bundle it
56
+
57
+ $ bundle install
58
+
59
+ Configure a JSON file called mutx.conf with the values you need
60
+
61
+ mutx/conf/mutx.conf
62
+
63
+ Start Mutx and follow instructions
64
+
65
+ $ mutx start
66
+
67
+
68
+ Important: Do not forget to include mutx folder to .gitignore if you will use git
69
+
70
+
71
+ How it works
72
+ ---------------------
73
+
74
+ When you run `mutx install` command, mutx will do:
75
+
76
+ - Update your Gemfile if it exist, else will create it. Also will define gem 'mutx' on it, of course.
77
+
78
+ - Creates a folder on your root project folder with some files on it. Those files are used by mutx to work.
79
+
80
+ The file called mutx.conf in conf/ folder has some configuration that you can/must modify ( or see at least). You should only use conf/mutx.conf and some logs files (logs/mutx.log & logs/sidekiq.log)
81
+
82
+ The file config.ru has the needed code to start the service (DO NOT MODIFY IT)
83
+
84
+ After configuring mutx.conf file you are able to run `mutx start`
85
+
86
+ After starting Mutx you can go to Help section and see all what you need to know to work with mutx regarding to set up test tasks, custom parameters and so.
87
+
88
+
89
+
90
+
91
+ === Can be changed ===
92
+ Reference about configuration
93
+
94
+ mutx/conf/mutx.conf file reference:
95
+
96
+ {
97
+ "use_git" : true,
98
+ "app_name" : "your-app-name",
99
+ "app_port" : 8080,
100
+ "database" : {
101
+ "type" : "mongodb",
102
+ "host" :"localhost",
103
+ "port" : 27017,
104
+ "username" : null,
105
+ "password" : null},
106
+ "project_name" : "Mutx",
107
+ "project_url" : "http://your.project.url",
108
+ "inactivity_timeout" : 60,
109
+ "kill_inactive_executions_after" : 300,
110
+ "datetime_format" : "%d/%m/%Y %H:%M:%S",
111
+ "refresh_time" : 10,
112
+ "notification" : {
113
+ "use_gmail" : false,
114
+ "username" : null,
115
+ "password" : null,
116
+ "recipients" : "your@email.com",
117
+ "attach_report" : false
118
+ },
119
+ "footer_text" : "Tests by a great and funny team",
120
+ "execution_tag_placeholder" : {
121
+ "datetime" : true,
122
+ "format" : "%d%^b%y-%H%M",
123
+ "default" : null
124
+ },
125
+ "headless" : {
126
+ "active" : false,
127
+ "resolution" : "1024x768",
128
+ "size":"24"}
129
+ }
130
+
131
+ This file is where you can configure:
132
+
133
+ "use_git": (Boolean) set as true if you are using git
134
+
135
+ "MONGO_host" : (String) The host where mongodb is running
136
+
137
+ "app_port" : (Fixnum/Int) The http port that Mutx will be listening
138
+
139
+ "project_name" : (String) The name of your Cucumber project
140
+
141
+ "project_url" : (String) The url of your project (basically the url of the repository)
142
+
143
+ "inactivity_timeout" : (Fixnum/Int) The time in seconds to consider an execution as inactive. This will show you the option to reset an inactive execution
144
+
145
+ "kill_inactive_executions_after" : (Fixnum/Int) The time in seconds to wait for killing automatically those inactive executions
146
+
147
+ "datetime_format" : "%d/%m/%Y %H:%M:%S"
148
+
149
+ "refresh_time" : (Fixnum/Int) The time in seconds to refresh result window in console view
150
+
151
+ "notification" : (Boolean) This is a flag to use notifications through gmail service. You should have a gmail account to use it.
152
+
153
+ "footer_text" : (String) A text you want to see at the footer like "Tests by a great team (team_name@domain.com"
154
+
155
+ "execution_tag_placeholder" : (JSON) If you want to use a simple execution id given by the actual time you can set the value of "datetime" to true (Boolean), with this option you can use a strftime format and it will put the execution id automatically.
156
+ If you set "datetime" to false (Boolean) you can use "default" value. Setting "datetime" as false and "default" as null you will have to (if you need it) set the execution id manually each time you run a task.
157
+
158
+ "headless" (JSON) : Set active as true to use headless mode
159
+
160
+
161
+ Available Commands
162
+ ---------------------
163
+
164
+ - To adapt your project to use mutx
165
+
166
+ $ mutx install
167
+
168
+ - To start mutx service
169
+
170
+ $ mutx start
171
+
172
+ - To clear all tasks and results collection. To erase all data from database
173
+
174
+ $ mutx reset
175
+
176
+ - To clear all tasks collection only. To erase all tasks data from database
177
+
178
+ $ mutx reset_tasks
179
+
180
+ - to shut down mutx
181
+
182
+ $ mutx stop
183
+
184
+ - to restart mutx
185
+
186
+ $ mutx restart
187
+
188
+
189
+ Get (what you need!)
190
+ ---------------------
191
+
192
+ - /mutx/tasks
193
+
194
+ - /mutx/tasks/`<task_name>`/run
195
+
196
+ - /mutx/results
197
+
198
+ - /mutx/results/`<task_name>`
199
+
200
+ - /mutx/results/`<result_id>`/log
201
+
202
+ - /mutx/results/`<result_id>`
203
+
204
+ - /mutx/help
205
+
206
+
207
+ Tip
208
+ ---------------------
209
+
210
+ If you shutdown mutx and then you want to get it up and the port you are using is already in use you could use the following commands (Ubunutu OS):
211
+
212
+ $sudo netstat -tapen | grep ":8080 "
213
+
214
+ In this example we use the port 8080. This command will give you the app that is using the port. Then you could kill it getting its PID previously.
215
+
216
+
217
+ API
218
+ =======
219
+
220
+ Returns the list of tasks
221
+
222
+ mutx/api/tasks
223
+
224
+ Returns the list of tasks that are running
225
+
226
+ mutx/api/tasks/running
227
+
228
+ Returns the status of the given task id
229
+
230
+ mutx/api/tasks/<task_id>/status
231
+
232
+ Returns the task structure for the given task id
233
+
234
+ mutx/api/tasks/<task_id>
235
+
236
+ Returns all existing results
237
+
238
+ mutx/api/results
239
+
240
+ Returns the result for a given result id
241
+
242
+ mutx/api/results/<result_id>
243
+
244
+ Returns the data you've added to result from execution
245
+
246
+ mutx/api/results/<result_id>/data
247
+
248
+
249
+
250
+ Contributing
251
+ ---------------------
252
+
253
+ 1. Fork it (http://github.com/romgrod/mutx/fork)
254
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
255
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
256
+ 4. Push to the branch (`git push origin my-new-feature`)
257
+ 5. Create new Pull Request
258
+ =======
259
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/.DS_Store ADDED
Binary file
data/bin/mutx ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'mutx'
3
+
4
+ Mutx::Base.start(ARGV)
data/cron.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'mutx'
2
+
3
+ module Cron
4
+ class Tasks
5
+
6
+ def self.cron_jobs
7
+ cron_tasks_list = Mutx::Database::MongoConnector.cron_tasks
8
+
9
+ cron_tasks_list.each do |task|
10
+ if (((!task[:cron_time].eql? "") && (!task[:cron_time].eql? "0")) && (((Time.now.utc - task[:last_exec_time].utc) + 1) >= (task[:cron_time].to_i * 60)))
11
+ query_string = {}
12
+ query_string = {"execution_name"=>"CRONNED-#{task[:cron_time]}-min"}
13
+ task_name = task[:name]
14
+ task_name.gsub!("%20"," ")
15
+ puts Mutx::API::Tasks.cron_update task
16
+ Mutx::API::Execution.start task_name, query_string
17
+ end
18
+ end
19
+ end
20
+ end#class
21
+ end#module
22
+
23
+ Cron::Tasks.cron_jobs
data/cron_alive.sh ADDED
@@ -0,0 +1,9 @@
1
+ A=`pgrep -f cronned_task.rb | wc -w`
2
+
3
+ if [ "$A" -eq 0 ]; then
4
+ echo "Starting Mutx Cron process"
5
+ export DISPLAY=:0;
6
+ ruby ./cronned_task.rb;
7
+ else
8
+ echo "Mutx Cron is already running"
9
+ fi
data/cronned_task.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'rufus/scheduler'
2
+
3
+ scheduler = Rufus::Scheduler.new
4
+
5
+ scheduler.every '1m' do
6
+ current_directory = Dir.pwd
7
+ system("cd #{current_directory}" && "bundle exec ruby cron.rb")
8
+ end
9
+ scheduler.join
@@ -0,0 +1,47 @@
1
+ How do i use the api?
2
+ ==============
3
+
4
+
5
+ Well, we want to do things as simple as possible, so we are using only GET requests. Everyone has a browser, so everyone has the possiblility to use Mutx.
6
+
7
+ Returns the list of tasks
8
+
9
+ mutx/api/tasks
10
+
11
+ Returns the list of tasks that are running
12
+
13
+ mutx/api/tasks/running
14
+
15
+ Returns the status of the given task id
16
+
17
+ mutx/api/tasks/<task_id>/status
18
+
19
+ Returns the task structure for the given task id
20
+
21
+ mutx/api/tasks/<task_id>
22
+
23
+ Returns all existing results
24
+
25
+ mutx/api/results
26
+
27
+ Returns the result for a given result id
28
+
29
+ mutx/api/results/<result_id>
30
+
31
+ Starts an execution
32
+
33
+ Perform get to:
34
+
35
+ mutx/api/tasks/<task_me>/run
36
+
37
+ # pass custom parameters as query string like vmutx/api/tasks/:task/run?environment=RC&foo=bar
38
+
39
+ # and if you want identify the execution, you can pass execution_name=your_execution_identification' as query string too.
40
+
41
+ If execution starts succesfully, it will return a result id
42
+
43
+
44
+ Returns the execution data for a given result id
45
+
46
+ mutx/api/results/<result_id>/data
47
+
@@ -0,0 +1,56 @@
1
+ Execution
2
+ ============================
3
+
4
+
5
+ With Mutx you can add data to the execution. Then you can find that data through the API by using
6
+
7
+ /mutx/api/results/<result id>/data
8
+
9
+ This will give you the JSON (a part of the result) with the data you setted while your execution was running.
10
+
11
+ ---------------------------------------
12
+
13
+ How to add execution data
14
+ ============================
15
+
16
+ Basically you have to add mutx gem to your project
17
+
18
+ require 'mutx'
19
+
20
+ Before, you have to add it to your Gemfile
21
+
22
+ # Gemfile
23
+ gem 'mutx'
24
+
25
+
26
+ After adding the gem to your project, you can do:
27
+
28
+ Mutx::Custom::Execution.add_data("my_data_key", "some value for data key")
29
+
30
+
31
+ Once the execution it is finished, you can see the values through:
32
+
33
+ http::/host:port/mutx/api/results/<result_id>/data
34
+
35
+ And you'll see something like:
36
+
37
+ {
38
+ type: "result",
39
+ _id: 1427901370053,
40
+ status: "stopped (Inactivity Timeout reached)",
41
+ execution_data: {
42
+ my_data_key: "some value for data key"
43
+ }
44
+ }
45
+
46
+
47
+ Think about this for integration tests.
48
+
49
+ ---------------------------------------
50
+
51
+ Path to output dir
52
+ ============================
53
+
54
+ If you want to save files you should use Mutx output dir path by using
55
+
56
+ "#{Mutx::Custom::Execution.output_path}/<your_file_name.extension>"