rrrspec-web 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc4ecd53611a3750d2a77c6d3a5031e37b2f95aa
4
- data.tar.gz: 9efa6d719da18dd0030dd5536cdd07b111860a60
3
+ metadata.gz: 7cf14379b712185801915a8c19fdf2550b1a47b6
4
+ data.tar.gz: 3e3cdc28c434287a4537d57c9291dfd297751d82
5
5
  SHA512:
6
- metadata.gz: 7b8d218f3d602579fa990d8d1c27644aad63508b5660af5e52a950dfb8c1ac74f28a519c0b1e454cc15c2185ec67142a14f6fdc830ba612a14d1cbe4126f7203
7
- data.tar.gz: a249a1e686a0b9accac57f79536ce1d18389c009fc60587151910bfccc51202c6841536f4c04ac3ba5644109e79b20363869e2377618e44b57a5296eaaa5610c
6
+ metadata.gz: ac86a6c45bec08509db8cb7950598fe019dcebaa49d94d972bd1298258e2db853ba2ad75c17d9a22ae8d75e9275797fa4c458c25405296f3240600a180d9a0f1
7
+ data.tar.gz: ba404454b32539a7279329c1c8ebbdcdfb3a9555ce07826d3371cfc99c9f2bcd6e7647292ffce9ea035ced2cf7885e7e1cc5b171798b9579f30729fe15a374c4
@@ -1,5 +1,5 @@
1
1
  module RRRSpec
2
2
  module Web
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrrspec-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaya Suzuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-30 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,22 +140,16 @@ dependencies:
140
140
  name: activerecord
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '4.0'
146
- - - "<"
143
+ - - "~>"
147
144
  - !ruby/object:Gem::Version
148
- version: '4.2'
145
+ version: 4.2.0
149
146
  type: :runtime
150
147
  prerelease: false
151
148
  version_requirements: !ruby/object:Gem::Requirement
152
149
  requirements:
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- version: '4.0'
156
- - - "<"
150
+ - - "~>"
157
151
  - !ruby/object:Gem::Version
158
- version: '4.2'
152
+ version: 4.2.0
159
153
  - !ruby/object:Gem::Dependency
160
154
  name: activesupport
161
155
  requirement: !ruby/object:Gem::Requirement
@@ -345,11 +339,6 @@ executables: []
345
339
  extensions: []
346
340
  extra_rdoc_files: []
347
341
  files:
348
- - ".gitignore"
349
- - ".rspec"
350
- - Gemfile
351
- - Guardfile
352
- - Rakefile
353
342
  - assets/javascripts/helpers.coffee
354
343
  - assets/javascripts/index.coffee
355
344
  - assets/javascripts/models.coffee
@@ -374,9 +363,6 @@ files:
374
363
  - lib/rrrspec/web/configuration.rb
375
364
  - lib/rrrspec/web/persistent_models.rb
376
365
  - lib/rrrspec/web/version.rb
377
- - rrrspec-web.gemspec
378
- - spec/rrrspec/web/api_spec.rb
379
- - spec/spec_helper.rb
380
366
  - tasks/assets.rake
381
367
  - views/index.haml
382
368
  - views/taskset.haml
@@ -401,10 +387,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
401
387
  version: '0'
402
388
  requirements: []
403
389
  rubyforge_project:
404
- rubygems_version: 2.4.5.1
390
+ rubygems_version: 2.5.1
405
391
  signing_key:
406
392
  specification_version: 4
407
393
  summary: Execute RSpec in a distributed manner
408
- test_files:
409
- - spec/rrrspec/web/api_spec.rb
410
- - spec/spec_helper.rb
394
+ test_files: []
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- public
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format progress
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rrrspec-client', path: '../'
4
- gem 'rrrspec-server', path: '../'
5
- gemspec
6
- gem 'unicorn'
data/Guardfile DELETED
@@ -1,4 +0,0 @@
1
- guard 'livereload' do
2
- watch(%r{^\.rb})
3
- watch(%r{views/.*})
4
- end
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
- load File.expand_path('../tasks/assets.rake', __FILE__)
@@ -1,49 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rrrspec/web/version'
5
- require 'pathname'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "rrrspec-web"
9
- spec.version = RRRSpec::Web::VERSION
10
- spec.authors = ["Masaya Suzuki"]
11
- spec.email = ["draftcode@gmail.com"]
12
- spec.description = "Execute RSpec in a distributed manner"
13
- spec.summary = "Execute RSpec in a distributed manner"
14
- spec.homepage = "https://github.com/cookpad/rrrspec"
15
- spec.license = "MIT"
16
-
17
- gemspec_dir = File.expand_path('..', __FILE__)
18
- spec.files = `git ls-files`.split($/).
19
- map { |f| File.absolute_path(f) }.
20
- select { |f| f.start_with?(gemspec_dir) }.
21
- map { |f| Pathname(f).relative_path_from(Pathname(gemspec_dir)).to_s }
22
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
- spec.require_paths = ["lib"]
25
-
26
- spec.add_development_dependency "bundler"
27
- spec.add_development_dependency "database_cleaner", "~> 1.2.0"
28
- spec.add_development_dependency "guard-livereload"
29
- spec.add_development_dependency "mysql2"
30
- spec.add_development_dependency "rack-livereload"
31
- spec.add_development_dependency "rack-test"
32
- spec.add_development_dependency "rake"
33
- spec.add_development_dependency "rspec"
34
- spec.add_development_dependency "sqlite3"
35
- spec.add_dependency "activerecord", ">= 4.0", "< 4.2"
36
- spec.add_dependency "activesupport"
37
- spec.add_dependency "api-pagination", "< 3.2.0"
38
- spec.add_dependency "bootstrap-sass", ">= 3.2"
39
- spec.add_dependency "coffee-script", "~> 2.2.0"
40
- spec.add_dependency "grape", '~> 0.9.0'
41
- spec.add_dependency "haml", "~> 4.0.3"
42
- spec.add_dependency "kaminari", "~> 0.16.0"
43
- spec.add_dependency "oj"
44
- spec.add_dependency "rrrspec-client"
45
- spec.add_dependency "rrrspec-server"
46
- spec.add_dependency "sass"
47
- spec.add_dependency "sinatra", "~> 1.4.3"
48
- spec.add_dependency "sinatra-asset-pipeline"
49
- end
@@ -1,286 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module RRRSpec
4
- RSpec.describe Web do
5
- before do
6
- RRRSpec.configuration = Web::WebConfiguration.new
7
- RRRSpec.configuration.redis = @redis
8
- RRRSpec.configuration.execute_log_text_path = Dir.mktmpdir
9
- end
10
-
11
- after do
12
- FileUtils.remove_entry_secure(RRRSpec.configuration.execute_log_text_path)
13
- end
14
-
15
- let(:taskset) do
16
- Taskset.create(
17
- 'testuser', 'echo 1', 'echo 2', 'default', 'default', 3, 3, 5, 5
18
- )
19
- end
20
-
21
- let(:task) do
22
- Task.create(taskset, 10, 'spec/test_spec.rb')
23
- end
24
-
25
- let!(:worker) do
26
- Worker.create('default')
27
- end
28
-
29
- let!(:worker_log) do
30
- WorkerLog.create(worker, taskset)
31
- end
32
-
33
- let!(:slave) do
34
- Slave.create
35
- end
36
-
37
- let(:trial) do
38
- Trial.create(task, slave)
39
- end
40
-
41
- def taskset_id
42
- RRRSpec::Server::Persistence::Taskset.by_redis_model(taskset).first!.id
43
- end
44
-
45
- before do
46
- taskset.add_task(task)
47
- taskset.enqueue_task(task)
48
-
49
- ActiveTaskset.add(taskset)
50
-
51
- worker_log.set_rsync_finished_time
52
- worker_log.append_log('worker_log log body')
53
- worker_log.set_setup_finished_time
54
-
55
- taskset.add_slave(slave)
56
- slave.append_log('slave log body')
57
-
58
- trial.start
59
- trial.finish('pending', 'stdout body', 'stderr body', 10, 2, 0)
60
-
61
- task.update_status('pending')
62
- taskset.append_log('taskset log body')
63
-
64
- taskset.incr_succeeded_count
65
- taskset.finish_task(task)
66
- taskset.update_status('succeeded')
67
- taskset.set_finished_time
68
-
69
- ActiveTaskset.remove(taskset)
70
-
71
- slave.update_status('normal_exit')
72
-
73
- worker_log.set_finished_time
74
- end
75
-
76
- describe Web::APIv2 do
77
- include Rack::Test::Methods
78
-
79
- def app
80
- Web::APIv2
81
- end
82
-
83
- describe "GET /v2/tasksets/actives" do
84
- before { ActiveTaskset.add(taskset) }
85
-
86
- it 'returns the active tasksets' do
87
- get "/v2/tasksets/actives"
88
- expect(last_response.status).to eq(200)
89
- expect(JSON.parse(last_response.body)).to eq([
90
- { 'key' => taskset.key, 'status' => taskset.status, 'rsync_name' => taskset.rsync_name, 'created_at' => taskset.created_at.iso8601 },
91
- ])
92
- end
93
- end
94
-
95
- describe "GET /v2/tasksets/recents" do
96
- context 'there are 11 tasksets' do
97
- before do
98
- 11.times { Server::Persistence::Taskset.create() }
99
- end
100
-
101
- it 'returns the recent 10 tasksets' do
102
- get "/v2/tasksets/recents"
103
- expect(last_response.status).to eq(200)
104
- expect(JSON.parse(last_response.body).size).to eq(10)
105
- end
106
- end
107
- end
108
-
109
- shared_context 'the taskset is persisted' do
110
- before do
111
- Server::Persister.persist(taskset)
112
- end
113
- end
114
-
115
- describe 'GET /v2/tasksets/:taskset_key' do
116
- context "when the taskset is persisted" do
117
- include_context 'the taskset is persisted'
118
-
119
- it 'returns a taskset in JSON' do
120
- get "/v2/tasksets/#{taskset.key}"
121
- expect(last_response.status).to eq(200)
122
- expect(JSON.parse(last_response.body)).to eq({
123
- "created_at" => taskset.created_at.iso8601,
124
- "finished_at" => taskset.finished_at.iso8601,
125
- "id" => 1,
126
- "key" => taskset.key,
127
- "max_trials" => 3,
128
- "max_workers" => 3,
129
- "rsync_name" => "testuser",
130
- "setup_command" => "echo 1",
131
- "slave_command" => "echo 2",
132
- "status" => "succeeded",
133
- "tasks" => [
134
- {
135
- "id" => 1,
136
- "key" => task.key,
137
- "status" => "pending",
138
- "spec_path" => "spec/test_spec.rb",
139
- "estimate_sec" => 10,
140
- "trials" => [
141
- {
142
- "id" => 1,
143
- "key" => trial.key,
144
- "task_id" => 1,
145
- "slave_id" => 1,
146
- "started_at" => trial.started_at.iso8601,
147
- "finished_at" => trial.finished_at.iso8601,
148
- "status" => "pending",
149
- "passed" => 10,
150
- "pending" => 2,
151
- "failed" => 0
152
- },
153
- ],
154
- },
155
- ],
156
- "taskset_class" => "default",
157
- "worker_type" => "default",
158
- })
159
- end
160
- end
161
-
162
- context "when the taskset is not persisted" do
163
- it "returns 404" do
164
- get "/v2/tasksets/#{taskset.key}"
165
- expect(last_response.status).to eq(404)
166
- end
167
- end
168
- end
169
-
170
- describe 'GET /v2/tasksets/:taskset_id/log' do
171
- context "when the taskset is persisted" do
172
- include_context 'the taskset is persisted'
173
-
174
- it 'returns a string in JSON' do
175
- get "/v2/tasksets/#{taskset_id}/log"
176
- expect(last_response.status).to eq(200)
177
- expect(JSON.parse(last_response.body)).to eq({
178
- 'log' => 'taskset log body',
179
- })
180
- end
181
- end
182
-
183
- context "when the taskset is not persisted" do
184
- it "returns 404" do
185
- get "/v2/tasksets/0/log"
186
- expect(last_response.status).to eq(404)
187
- end
188
- end
189
- end
190
-
191
- describe 'GET /v2/tasks/:task_id/trials' do
192
- context "when the taskset is persisted" do
193
- include_context 'the taskset is persisted'
194
-
195
- it 'returns trials in JSON' do
196
- get "/v2/tasks/#{taskset_id}/trials"
197
- expect(last_response.status).to eq(200)
198
- expect(JSON.parse(last_response.body)).to eq([
199
- {
200
- "id" => 1,
201
- "key" => trial.key,
202
- "task_id" => 1,
203
- "slave_id" => 1,
204
- "started_at" => trial.started_at.iso8601,
205
- "finished_at" => trial.finished_at.iso8601,
206
- "status" => "pending",
207
- "passed" => 10,
208
- "pending" => 2,
209
- "failed" => 0,
210
- },
211
- ])
212
- end
213
- end
214
-
215
- context "when the taskset is not persisted" do
216
- it "returns 404" do
217
- get "/v2/tasksets/#{taskset.key}/trials"
218
- expect(last_response.status).to eq(404)
219
- end
220
- end
221
- end
222
-
223
- describe 'GET /v2/tasksets/:taskset_id/worker_logs' do
224
- context "when the taskset is persisted" do
225
- include_context 'the taskset is persisted'
226
-
227
- it 'returns worker logs in JSON' do
228
- get "/v2/tasksets/#{taskset_id}/worker_logs"
229
- expect(last_response.status).to eq(200)
230
- expect(JSON.parse(last_response.body)).to eq([
231
- {
232
- "id" => 1,
233
- "worker_name" => "rrrspec:worker:testhostname",
234
- "started_at" => worker_log.started_at.iso8601,
235
- "rsync_finished_at" => worker_log.rsync_finished_at.iso8601,
236
- "setup_finished_at" => worker_log.setup_finished_at.iso8601,
237
- "rspec_finished_at" => worker_log.finished_at.iso8601,
238
- "log" => "worker_log log body",
239
- },
240
- ])
241
- end
242
- end
243
-
244
- context "when the taskset is not persisted" do
245
- it "returns 404" do
246
- get "/v2/tasksets/0/worker_logs"
247
- expect(last_response.status).to eq(404)
248
- end
249
- end
250
- end
251
-
252
- describe 'GET /v2/tasksets/:taskset_id/slaves' do
253
- context "when the taskset is persisted" do
254
- include_context 'the taskset is persisted'
255
-
256
- it 'returns slaves in JSON' do
257
- get "/v2/tasksets/#{taskset_id}/slaves"
258
- expect(last_response.status).to eq(200)
259
- expect(JSON.parse(last_response.body)).to eq([
260
- {
261
- "id" => 1,
262
- "name" => slave.key,
263
- "status" => "normal_exit",
264
- "trials" => [
265
- {
266
- "id" => 1,
267
- "key" => trial.key,
268
- },
269
- ],
270
- "log" => "slave log body",
271
- },
272
- ])
273
- end
274
- end
275
-
276
- context "when the taskset is not persisted" do
277
- it "returns 404" do
278
- get "/v2/tasksets/0/slaves"
279
- expect(last_response.status).to eq(404)
280
- end
281
- end
282
- end
283
-
284
- end
285
- end
286
- end
@@ -1,78 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # Require this file using `require "spec_helper"` to ensure that it is only
4
- # loaded once.
5
- #
6
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
- require 'rrrspec/web'
8
- require 'rack/test'
9
- require 'database_cleaner'
10
-
11
- RSpec.configure do |config|
12
- config.raise_errors_for_deprecations!
13
- config.disable_monkey_patching!
14
- config.run_all_when_everything_filtered = true
15
- config.filter_run :focus
16
-
17
- # Run specs in random order to surface order dependencies. If you find an
18
- # order dependency and want to debug it, you can fix the order by providing
19
- # the seed, which is printed after each run.
20
- # --seed 1234
21
- config.order = 'random'
22
-
23
- pid = nil
24
- config.before(:suite) do
25
- pid = Kernel.spawn("redis-server --port 9999 --save ''",
26
- in: '/dev/null', out: '/dev/null', err: '/dev/null')
27
- redis = Redis.new(port: 9999)
28
- retry_count = 1
29
- loop do
30
- begin
31
- redis.client.connect
32
- break
33
- rescue Redis::CannotConnectError
34
- if retry_count < 10
35
- retry_count += 1
36
- sleep 0.01
37
- retry
38
- end
39
- raise
40
- end
41
- end
42
- end
43
-
44
- config.before(:each) do
45
- @redis = Redis.new(port: 9999)
46
- @redis.flushall
47
-
48
- RRRSpec.configuration = nil
49
- RRRSpec.flushredis
50
- RRRSpec.hostname = 'testhostname'
51
- end
52
-
53
- config.after(:suite) do
54
- Process.kill('KILL', pid) if pid
55
- end
56
-
57
- def key(*args)
58
- args.join(':')
59
- end
60
-
61
- config.before(:suite) do
62
- ActiveRecord::Base.establish_connection(
63
- adapter: "sqlite3", database: ":memory:"
64
- )
65
- ActiveRecord::Migration.verbose = false
66
- ActiveRecord::Migrator.up "#{Gem::Specification.find_by_name('rrrspec-server').gem_dir}/db/migrate"
67
- DatabaseCleaner.strategy = :transaction
68
- DatabaseCleaner.clean_with(:truncation)
69
- end
70
-
71
- config.before(:each) do
72
- DatabaseCleaner.start
73
- end
74
-
75
- config.after(:each) do
76
- DatabaseCleaner.clean
77
- end
78
- end