tddium-preview 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +44 -5
- data/features/manage_login.feature +18 -0
- data/features/step_definitions/login_steps.rb +0 -0
- data/features/step_definitions/mimic_steps.rb +7 -0
- data/features/support/env.rb +5 -0
- data/features/support/mimic.rb +129 -0
- data/lib/tddium.rb +17 -10
- data/lib/tddium/constant.rb +1 -1
- data/lib/tddium/version.rb +1 -1
- data/tddium.gemspec +2 -1
- metadata +26 -10
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,23 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tddium-preview (0.7.
|
4
|
+
tddium-preview (0.7.1)
|
5
5
|
bundler
|
6
6
|
highline
|
7
7
|
json
|
8
|
-
tddium_client (>= 0.0.
|
8
|
+
tddium_client (>= 0.0.9)
|
9
|
+
tddium_reporting (>= 0.0.3)
|
9
10
|
thor
|
10
11
|
|
11
12
|
GEM
|
12
13
|
remote: http://rubygems.org/
|
13
14
|
specs:
|
15
|
+
aruba (0.3.6)
|
16
|
+
childprocess (>= 0.1.7)
|
17
|
+
cucumber (>= 0.10.0)
|
18
|
+
rspec (>= 2.5.0)
|
19
|
+
builder (3.0.0)
|
20
|
+
childprocess (0.2.0)
|
21
|
+
ffi (~> 1.0.6)
|
14
22
|
crack (0.1.8)
|
23
|
+
cucumber (1.0.2)
|
24
|
+
builder (>= 2.1.2)
|
25
|
+
diff-lcs (>= 1.1.2)
|
26
|
+
gherkin (~> 2.4.5)
|
27
|
+
json (>= 1.4.6)
|
28
|
+
term-ansicolor (>= 1.0.5)
|
29
|
+
daemons (1.1.4)
|
15
30
|
diff-lcs (1.1.2)
|
16
31
|
fakefs (0.3.1)
|
32
|
+
ffi (1.0.9)
|
33
|
+
gherkin (2.4.5)
|
34
|
+
json (>= 1.4.6)
|
17
35
|
highline (1.6.2)
|
18
|
-
httparty (0.7.
|
36
|
+
httparty (0.7.8)
|
19
37
|
crack (= 0.1.8)
|
20
|
-
json (1.5.
|
38
|
+
json (1.5.3)
|
39
|
+
mimic (0.4.3)
|
40
|
+
json
|
41
|
+
plist
|
42
|
+
rack
|
43
|
+
sinatra
|
44
|
+
pickle (0.4.8)
|
45
|
+
cucumber (>= 0.8)
|
46
|
+
rake
|
47
|
+
plist (3.1.0)
|
48
|
+
rack (1.3.0)
|
21
49
|
rake (0.8.7)
|
22
50
|
rspec (2.5.0)
|
23
51
|
rspec-core (~> 2.5.0)
|
@@ -30,16 +58,27 @@ GEM
|
|
30
58
|
simplecov (0.4.1)
|
31
59
|
simplecov-html (~> 0.4.3)
|
32
60
|
simplecov-html (0.4.3)
|
33
|
-
|
61
|
+
sinatra (1.2.6)
|
62
|
+
rack (~> 1.1)
|
63
|
+
tilt (< 2.0, >= 1.2.2)
|
64
|
+
tddium_client (0.0.9)
|
34
65
|
httparty
|
35
66
|
json
|
67
|
+
tddium_reporting (0.0.3)
|
68
|
+
term-ansicolor (1.0.6)
|
36
69
|
thor (0.14.6)
|
70
|
+
tilt (1.3.2)
|
37
71
|
|
38
72
|
PLATFORMS
|
39
73
|
ruby
|
40
74
|
|
41
75
|
DEPENDENCIES
|
76
|
+
aruba
|
77
|
+
daemons
|
42
78
|
fakefs
|
79
|
+
httparty
|
80
|
+
mimic
|
81
|
+
pickle
|
43
82
|
rake
|
44
83
|
rspec
|
45
84
|
simplecov
|
@@ -0,0 +1,18 @@
|
|
1
|
+
@mimic
|
2
|
+
Feature: Manage Login
|
3
|
+
|
4
|
+
Scenario: Log in successfully
|
5
|
+
Given the user can log in and gets API key "apikey"
|
6
|
+
#When I run `tddium login --environment=mimic --email=user@example.org --password=password`
|
7
|
+
When I run `tddium login --environment=mimic` interactively
|
8
|
+
And I type "foo@example.com"
|
9
|
+
And I type "barbarbar"
|
10
|
+
And the console session ends
|
11
|
+
Then the output should contain:
|
12
|
+
"""
|
13
|
+
Logged in successfully
|
14
|
+
"""
|
15
|
+
And the exit status should be 0
|
16
|
+
And the file ".tddium.mimic" should contain "apikey"
|
17
|
+
And the file ".gitignore" should contain ".tddium.mimic"
|
18
|
+
And the file ".gitignore" should contain ".tddium-deploy-key.mimic"
|
File without changes
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'mimic'
|
2
|
+
require 'timeout'
|
3
|
+
require 'daemons'
|
4
|
+
require 'httparty'
|
5
|
+
|
6
|
+
class MimicServer
|
7
|
+
attr_reader :port
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@port = 8080
|
11
|
+
@pid_dir = File.join(Dir.tmpdir, 'mimic')
|
12
|
+
FileUtils.mkdir_p(@pid_dir)
|
13
|
+
end
|
14
|
+
|
15
|
+
def start
|
16
|
+
options = {:ARGV => ['start'], :log_output => true, :dir_mode => :normal, :dir => @pid_dir}
|
17
|
+
args = {:fork => false,
|
18
|
+
:host => 'localhost',
|
19
|
+
:port => @port,
|
20
|
+
:remote_configuration_path => '/api'}
|
21
|
+
@mimic_group = Daemons.run_proc("mimic", options) do
|
22
|
+
Mimic.mimic(args) do
|
23
|
+
[:INT, :TERM].each { |sig| trap(sig) { STDERR.puts "got sig!"; Kernel.exit!(0) } }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
@mimic_group.setup
|
27
|
+
wait
|
28
|
+
end
|
29
|
+
|
30
|
+
def stop
|
31
|
+
return nil unless @mimic_group
|
32
|
+
@mimic_group.stop_all
|
33
|
+
@mimic_group.find_applications(@pid_dir)
|
34
|
+
@mimic_group.zap_all
|
35
|
+
end
|
36
|
+
|
37
|
+
def wait
|
38
|
+
(0...5).each do |i|
|
39
|
+
if ping then
|
40
|
+
break
|
41
|
+
end
|
42
|
+
Kernel.sleep(0.1)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def ping
|
47
|
+
begin
|
48
|
+
http = call_api(:get, '/api/ping')
|
49
|
+
rescue Exception, Timeout::Error
|
50
|
+
return false
|
51
|
+
end
|
52
|
+
return http.code == 200
|
53
|
+
end
|
54
|
+
|
55
|
+
def clear
|
56
|
+
http = call_api(:post, '/api/clear')
|
57
|
+
return http
|
58
|
+
end
|
59
|
+
|
60
|
+
def install(verb, path, body, headers = {})
|
61
|
+
params = { 'path' => path, 'body' => body.to_json }.to_json
|
62
|
+
http = call_api(:post, "/api/#{verb}", params, headers)
|
63
|
+
return http
|
64
|
+
end
|
65
|
+
|
66
|
+
def call_api(method, path, params = {}, headers = {})
|
67
|
+
tries = 0
|
68
|
+
retries = 7
|
69
|
+
done = false
|
70
|
+
while (tries <= retries) && !done
|
71
|
+
begin
|
72
|
+
http = HTTParty.send(method, "http://localhost:#{@port}#{path}",
|
73
|
+
:body => params, :headers => headers)
|
74
|
+
done = true
|
75
|
+
rescue SystemCallError
|
76
|
+
Kernel.sleep(0.5)
|
77
|
+
rescue Timeout::Error
|
78
|
+
Kernel.sleep(0.5)
|
79
|
+
ensure
|
80
|
+
tries += 1
|
81
|
+
end
|
82
|
+
end
|
83
|
+
raise Timeout::Error if tries > retries && retries >= 0
|
84
|
+
return http
|
85
|
+
end
|
86
|
+
|
87
|
+
class << self
|
88
|
+
def test
|
89
|
+
mimic = MimicServer.start
|
90
|
+
mimic.clear
|
91
|
+
mimic.stop
|
92
|
+
end
|
93
|
+
|
94
|
+
def start
|
95
|
+
return @server if @server
|
96
|
+
@server = MimicServer.new
|
97
|
+
@server.start
|
98
|
+
@server
|
99
|
+
end
|
100
|
+
|
101
|
+
def server
|
102
|
+
@server
|
103
|
+
end
|
104
|
+
|
105
|
+
def clear
|
106
|
+
@server.clear rescue nil
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
if __FILE__ == $0 then
|
112
|
+
MimicServer.test
|
113
|
+
end
|
114
|
+
|
115
|
+
Before('@mimic') do
|
116
|
+
MimicServer.start
|
117
|
+
# @aruba_io_wait_seconds = 4
|
118
|
+
end
|
119
|
+
|
120
|
+
After('@mimic') do
|
121
|
+
MimicServer.clear
|
122
|
+
end
|
123
|
+
|
124
|
+
at_exit do
|
125
|
+
server = MimicServer.server
|
126
|
+
server.stop if server
|
127
|
+
end
|
128
|
+
|
129
|
+
MimicServer.start
|
data/lib/tddium.rb
CHANGED
@@ -286,23 +286,16 @@ class Tddium < Thor
|
|
286
286
|
if current_suites["suites"].size == 0
|
287
287
|
say Text::Status::NO_SUITE
|
288
288
|
else
|
289
|
-
say Text::Status::ALL_SUITES % current_suites["suites"].collect {|suite| suite["repo_name"]}.join(", ")
|
290
|
-
|
291
289
|
if current_suite = current_suites["suites"].detect {|suite| suite["id"] == current_suite_id}
|
290
|
+
show_session_details({:active => false, :order => "date", :limit => 10}, Text::Status::NO_INACTIVE_SESSION, Text::Status::INACTIVE_SESSIONS)
|
291
|
+
show_session_details({:active => true}, Text::Status::NO_ACTIVE_SESSION, Text::Status::ACTIVE_SESSIONS)
|
292
292
|
say Text::Status::SEPARATOR
|
293
293
|
say Text::Status::CURRENT_SUITE % current_suite["repo_name"]
|
294
|
-
|
295
294
|
display_attributes(DisplayedAttributes::SUITE, current_suite)
|
296
|
-
|
297
|
-
show_session_details({:active => true}, Text::Status::NO_ACTIVE_SESSION, Text::Status::ACTIVE_SESSIONS)
|
298
|
-
show_session_details({:active => false, :order => "date", :limit => 10}, Text::Status::NO_INACTIVE_SESSION, Text::Status::INACTIVE_SESSIONS)
|
299
295
|
else
|
300
296
|
say Text::Status::CURRENT_SUITE_UNAVAILABLE
|
301
297
|
end
|
302
298
|
end
|
303
|
-
|
304
|
-
account_usage = call_api(:get, Api::Path::ACCOUNT_USAGE)
|
305
|
-
say account_usage["usage"]
|
306
299
|
rescue TddiumClient::Error::Base
|
307
300
|
end
|
308
301
|
end
|
@@ -670,7 +663,7 @@ class Tddium < Thor
|
|
670
663
|
say no_session_prompt
|
671
664
|
else
|
672
665
|
say all_session_prompt
|
673
|
-
current_sessions["sessions"].
|
666
|
+
current_sessions["sessions"].reverse_each do |session|
|
674
667
|
session_id = session.delete("id")
|
675
668
|
say Text::Status::SESSION_TITLE % session_id
|
676
669
|
display_attributes(DisplayedAttributes::TEST_EXECUTION, session)
|
@@ -686,6 +679,20 @@ class Tddium < Thor
|
|
686
679
|
# Account creation date
|
687
680
|
user = api_response["user"]
|
688
681
|
say ERB.new(Text::Status::USER_DETAILS).result(binding)
|
682
|
+
|
683
|
+
begin
|
684
|
+
current_suites = call_api(:get, Api::Path::SUITES)
|
685
|
+
if current_suites["suites"].size == 0 then
|
686
|
+
say Text::Status::NO_SUITE
|
687
|
+
else
|
688
|
+
say Text::Status::ALL_SUITES % current_suites["suites"].collect {|suite| suite["repo_name"]}.join(", ")
|
689
|
+
end
|
690
|
+
|
691
|
+
account_usage = call_api(:get, Api::Path::ACCOUNT_USAGE)
|
692
|
+
say account_usage["usage"]
|
693
|
+
rescue TddiumClient::Error::Base => e
|
694
|
+
puts "EXN: #{e.inspect}"
|
695
|
+
end
|
689
696
|
end
|
690
697
|
|
691
698
|
def format_suite_details(suite)
|
data/lib/tddium/constant.rb
CHANGED
@@ -12,7 +12,7 @@ module TddiumConstant
|
|
12
12
|
SLEEP_TIME_BETWEEN_POLLS = 2
|
13
13
|
ENVIRONMENT = "production"
|
14
14
|
SSH_FILE = "~/.ssh/id_rsa.pub"
|
15
|
-
SUITE_TEST_PATTERN = "features/*.feature, spec/**/*_spec.rb, test
|
15
|
+
SUITE_TEST_PATTERN = "features/*.feature, spec/**/*_spec.rb, test/**/*_test.rb"
|
16
16
|
end
|
17
17
|
|
18
18
|
module Git
|
data/lib/tddium/version.rb
CHANGED
data/tddium.gemspec
CHANGED
@@ -35,7 +35,8 @@ EOF
|
|
35
35
|
s.add_runtime_dependency("thor")
|
36
36
|
s.add_runtime_dependency("highline")
|
37
37
|
s.add_runtime_dependency("json")
|
38
|
-
s.add_runtime_dependency("tddium_client", ">=0.0.
|
38
|
+
s.add_runtime_dependency("tddium_client", ">=0.0.9")
|
39
|
+
s.add_runtime_dependency("tddium_reporting", ">=0.0.3")
|
39
40
|
s.add_runtime_dependency("bundler")
|
40
41
|
|
41
42
|
s.add_development_dependency("rspec")
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tddium-preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Solano Labs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-01 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -54,22 +54,22 @@ dependencies:
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 0.0.
|
57
|
+
version: 0.0.9
|
58
58
|
type: :runtime
|
59
59
|
version_requirements: *id004
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: tddium_reporting
|
62
62
|
prerelease: false
|
63
63
|
requirement: &id005 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.0.3
|
69
69
|
type: :runtime
|
70
70
|
version_requirements: *id005
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: bundler
|
73
73
|
prerelease: false
|
74
74
|
requirement: &id006 !ruby/object:Gem::Requirement
|
75
75
|
none: false
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: "0"
|
80
|
-
type: :
|
80
|
+
type: :runtime
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
83
|
+
name: rspec
|
84
84
|
prerelease: false
|
85
85
|
requirement: &id007 !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
@@ -91,7 +91,7 @@ dependencies:
|
|
91
91
|
type: :development
|
92
92
|
version_requirements: *id007
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: fakefs
|
95
95
|
prerelease: false
|
96
96
|
requirement: &id008 !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
@@ -102,7 +102,7 @@ dependencies:
|
|
102
102
|
type: :development
|
103
103
|
version_requirements: *id008
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
105
|
+
name: simplecov
|
106
106
|
prerelease: false
|
107
107
|
requirement: &id009 !ruby/object:Gem::Requirement
|
108
108
|
none: false
|
@@ -112,6 +112,17 @@ dependencies:
|
|
112
112
|
version: "0"
|
113
113
|
type: :development
|
114
114
|
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: rake
|
117
|
+
prerelease: false
|
118
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: "0"
|
124
|
+
type: :development
|
125
|
+
version_requirements: *id010
|
115
126
|
description: |
|
116
127
|
tddium runs your rspec, cucumber, and test::unit tests in our managed
|
117
128
|
cloud environment. You can run tests by hand, or enable our hosted CI to watch
|
@@ -140,6 +151,11 @@ files:
|
|
140
151
|
- README.rdoc
|
141
152
|
- Rakefile
|
142
153
|
- bin/tddium
|
154
|
+
- features/manage_login.feature
|
155
|
+
- features/step_definitions/login_steps.rb
|
156
|
+
- features/step_definitions/mimic_steps.rb
|
157
|
+
- features/support/env.rb
|
158
|
+
- features/support/mimic.rb
|
143
159
|
- lib/tddium.rb
|
144
160
|
- lib/tddium/constant.rb
|
145
161
|
- lib/tddium/heroku.rb
|