tddium-preview 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tddium-preview (0.10.0)
4
+ tddium-preview (0.11.0)
5
5
  bundler
6
6
  highline
7
7
  json
@@ -14,7 +14,34 @@ Feature: spec command
14
14
  And the output should contain "tddium login"
15
15
  And the output should contain "tddium heroku"
16
16
 
17
- Scenario: Output machine readable data
17
+ Scenario: Don't remember test pattern or max-parallelism
18
+ Given the destination repo exists
19
+ And a git repo is initialized
20
+ And the user is logged in with a configured suite
21
+ And the user can create a session
22
+ And the user successfully registers tests for the suite with test_pattern: "spec/foo"
23
+ And the tests start successfully
24
+ And the test all pass
25
+ When I run `tddium spec --max-parallelism=1 --test-pattern=spec/foo`
26
+ Then the exit status should be 0
27
+ And the output should contain "Test report"
28
+ And options should not be saved
29
+
30
+ Scenario: Ignore remembered test pattern and max-parallelism
31
+ Given the destination repo exists
32
+ And a git repo is initialized
33
+ And the user is logged in with a configured suite and remembered options
34
+ And the user can create a session
35
+ And the user successfully registers tests for the suite with test_pattern: default
36
+ And the tests start successfully
37
+ And the test all pass
38
+ When I run `tddium spec`
39
+ Then the exit status should be 0
40
+ And the output should contain "Test report"
41
+ And the output should not contain "emembered"
42
+ And options should not be saved
43
+
44
+ Scenario: Output machine readable data with --machine
18
45
  Given the destination repo exists
19
46
  And a git repo is initialized
20
47
  And the user is logged in with a configured suite
@@ -33,7 +60,7 @@ Feature: spec command
33
60
  %%%% TDDIUM CI DATA END %%%%
34
61
  """
35
62
 
36
- Scenario: Don't output machine readable data
63
+ Scenario: Don't output machine readable data in normal mode
37
64
  Given the destination repo exists
38
65
  And a git repo is initialized
39
66
  And the user is logged in with a configured suite
@@ -8,6 +8,10 @@ Given /^the destination repo exists$/ do
8
8
  }
9
9
  end
10
10
 
11
+ Given /^an old version of git is installed$/ do
12
+ pending
13
+ end
14
+
11
15
  Given /^a git repo is initialized(?: on branch "([^"]*)")?$/ do |branch|
12
16
  steps %Q{
13
17
  Given a directory named "work"
@@ -26,6 +26,21 @@ Given /^the user is logged in with a configured suite(?: on branch "(.*)")?$/ do
26
26
  }
27
27
  end
28
28
 
29
+ Given /^the user is logged in with a configured suite and remembered options$/ do
30
+ @api_key = "abcdef"
31
+ branch ||= "master"
32
+ Antilles.install(:get, "/1/users", SAMPLE_USER_RESPONSE)
33
+ Antilles.install(:get, "/1/accounts/usage", SAMPLE_ACCOUNT_USAGE)
34
+ steps %Q{
35
+ Given a file named ".tddium.mimic" with:
36
+ """
37
+ {"api_key":"#{@api_key}", "branches":{"#{branch}":{"id":1,"options":{"user_data_file":null,"max_parallelism":1,"test_pattern":"abc"}}}}
38
+ """
39
+ And the user has a suite for "repo" on "#{branch}"
40
+ }
41
+ end
42
+
43
+
29
44
  Given /^the user can log in and gets API key "([^"]*)"$/ do |apikey|
30
45
  Antilles.install(:post, "/1/users/sign_in", {:status=>0, :api_key=>apikey})
31
46
  end
@@ -41,3 +56,12 @@ Then /^dotfiles should be updated$/ do
41
56
  And the file ".gitignore" should contain ".tddium*"
42
57
  }
43
58
  end
59
+
60
+ Then /^options should not be saved$/ do
61
+ steps %Q{
62
+ Then the file ".tddium.mimic" should not contain "test_pattern"
63
+ And the file ".tddium.mimic" should not contain "max_parallelism"
64
+ And the file ".tddium.mimic" should not contain "user_data_file"
65
+ }
66
+ end
67
+
@@ -2,8 +2,15 @@ Given /^the user can create a session$/ do
2
2
  Antilles.install(:post, "/1/sessions", {:status=>0, :session=>{"id"=>SAMPLE_SESSION_ID}}, :code=>201)
3
3
  end
4
4
 
5
- Given /^the user successfully registers tests for the suite$/ do
6
- Antilles.install(:post, "/1/sessions/#{SAMPLE_SESSION_ID}/test_executions/register", {:status=>0})
5
+ Given /^the user successfully registers tests for the suite(?: with test_pattern: (.*))?$/ do |pattern|
6
+ options = {}
7
+ if pattern == 'default'
8
+ options['params'] = {'suite_id'=>SAMPLE_SUITE_ID.to_s, 'test_pattern'=>''}
9
+ elsif pattern
10
+ options['params'] = {'suite_id'=>SAMPLE_SUITE_ID.to_s, 'test_pattern'=>pattern.gsub(/"/,'')}
11
+ end
12
+ res = Antilles.install(:post, "/1/sessions/#{SAMPLE_SESSION_ID}/test_executions/register", {:status=>0}, options)
13
+ puts res.parsed_response
7
14
  end
8
15
 
9
16
  Given /^the tests start successfully$/ do
@@ -17,14 +17,11 @@ Feature: suite command
17
17
  :tddium:
18
18
  :ruby_version: ruby-1.9.2-p290-psych
19
19
  """
20
- When I run `tddium suite` interactively
21
- Then the output from "tddium suite" should contain "Looks like"
22
- And I respond to "repo name" with "beta"
23
- Then the output from "tddium suite" should contain "Detected branch test/foobar"
24
- Then the output from "tddium suite" should contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
25
- When I choose defaults for test pattern, CI and campfire settings
26
- Then the output from "tddium suite" should contain "Created suite..."
27
- When the console session ends
20
+ When I run `tddium suite --name=beta --ci-pull-url=disable --ci-push-url=disable --test-pattern=spec/* --campfire-subdomain=disable`
21
+ Then the output should contain "Looks like"
22
+ Then the output should contain "Detected branch test/foobar"
23
+ Then the output should contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
24
+ Then the output should contain "Created suite..."
28
25
  Then the exit status should be 0
29
26
 
30
27
  Scenario: Configure new suite with tddium.yml without matching key
@@ -35,15 +32,10 @@ Feature: suite command
35
32
  :foo:
36
33
  :ruby_version: ruby-1.9.2-p290-psych
37
34
  """
38
- When I run `tddium suite` interactively
39
- Then the output from "tddium suite" should contain "Looks like"
40
- And I respond to "repo name" with "beta"
41
- Then the output from "tddium suite" should contain "Detected branch test/foobar"
42
- Then the output from "tddium suite" should not contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
43
- Then the output from "tddium suite" should contain "Detected ruby"
44
- When I choose defaults for test pattern, CI and campfire settings
45
- Then the output from "tddium suite" should contain "Created suite..."
46
- When the console session ends
35
+ When I run `tddium suite --name=beta --ci-pull-url=disable --ci-push-url=disable --test-pattern=spec/* --campfire-subdomain=disable`
36
+ Then the output should not contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
37
+ Then the output should contain "Detected ruby"
38
+ Then the output should contain "Created suite..."
47
39
  Then the exit status should be 0
48
40
 
49
41
  Scenario: Configure new suite with empty tddium.yml
@@ -51,15 +43,12 @@ Feature: suite command
51
43
  And a file named "config/tddium.yml" with:
52
44
  """
53
45
  """
54
- When I run `tddium suite` interactively
55
- Then the output from "tddium suite" should contain "Looks like"
56
- And I respond to "repo name" with "beta"
57
- Then the output from "tddium suite" should contain "Detected branch test/foobar"
58
- Then the output from "tddium suite" should not contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
59
- Then the output from "tddium suite" should contain "Detected ruby"
60
- When I choose defaults for test pattern, CI and campfire settings
61
- Then the output from "tddium suite" should contain "Created suite..."
62
- When the console session ends
46
+ When I run `tddium suite --name=beta --ci-pull-url=disable --ci-push-url=disable --test-pattern=spec/* --campfire-subdomain=disable`
47
+ Then the output should contain "Looks like"
48
+ Then the output should contain "Detected branch test/foobar"
49
+ Then the output should not contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
50
+ Then the output should contain "Detected ruby"
51
+ Then the output should contain "Created suite..."
63
52
  Then the exit status should be 0
64
53
 
65
54
  Scenario: Non-YAML tddium.yml should generate a warning and then prompt
@@ -1,5 +1,28 @@
1
1
  # Copyright (c) 2011 Solano Labs All Rights Reserved
2
2
 
3
+ require 'mimic'
4
+
5
+ module Mimic
6
+ class FakeHost
7
+ class StubbedRequest
8
+ def unmatched_response
9
+ res = [404, {}, '{"status":1, "explanation":"not found"}']
10
+ puts "unmatched: #{res}"
11
+ res
12
+ end
13
+
14
+ def matches?(request)
15
+ if @params.any?
16
+ puts "checking params... got: #{request.params.inspect}, expected: #{@params}"
17
+ request.params == @params
18
+ else
19
+ true
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+
3
26
  require 'antilles/cucumber'
4
27
 
5
28
  port = Antilles.find_available_port
@@ -418,10 +418,10 @@ class Tddium < Thor
418
418
  write_tddium_to_gitignore
419
419
  end
420
420
 
421
- def write_suite(suite, options = {})
421
+ def write_suite(suite)
422
422
  suite_id = suite["id"]
423
423
  branches = tddium_settings["branches"] || {}
424
- branches.merge!({current_git_branch => {"id" => suite_id, "options" => options}})
424
+ branches.merge!({current_git_branch => {"id" => suite_id}})
425
425
  File.open(tddium_file_name, "w") do |file|
426
426
  file.write(tddium_settings.merge({"branches" => branches}).to_json)
427
427
  end
@@ -8,6 +8,7 @@ class Tddium
8
8
  def account
9
9
  set_shell
10
10
  set_default_environment
11
+ git_version_ok
11
12
  if user_details = user_logged_in?(true, true)
12
13
  # User is already logged in, so just display the info
13
14
  show_user_details(user_details)
@@ -19,6 +20,7 @@ class Tddium
19
20
  desc "account:add [ROLE] [EMAIL]", "Authorize and invite a user to use your account"
20
21
  define_method "account:add" do |role, email|
21
22
  set_shell
23
+ git_version_ok
22
24
  set_default_environment
23
25
  user_details = user_logged_in?(true, true)
24
26
  exit_failure unless user_details
@@ -36,6 +38,7 @@ class Tddium
36
38
  desc "account:remove [EMAIL]", "Remove a user from your account"
37
39
  define_method "account:remove" do |email|
38
40
  set_shell
41
+ git_version_ok
39
42
  set_default_environment
40
43
  user_details = user_logged_in?(true, true)
41
44
  exit_failure unless user_details
@@ -10,6 +10,7 @@ class Tddium
10
10
  def activate
11
11
  set_shell
12
12
  set_default_environment
13
+ git_version_ok
13
14
  if user_details = user_logged_in?
14
15
  exit_failure Text::Error::ACTIVATE_LOGGED_IN
15
16
  else
@@ -11,6 +11,7 @@ class Tddium
11
11
  def heroku
12
12
  set_shell
13
13
  set_default_environment
14
+ git_version_ok
14
15
  if user_details = user_logged_in?
15
16
  # User is already logged in, so just display the info
16
17
  show_user_details(user_details)
@@ -6,13 +6,13 @@ class Tddium
6
6
  map "cucumber" => :spec
7
7
  map "test" => :spec
8
8
  map "run" => :spec
9
- desc "spec", "Run the test suite"
9
+ desc "spec [PATTERN]", "Run the test suite, or tests that match PATTERN"
10
10
  method_option :user_data_file, :type => :string, :default => nil
11
11
  method_option :max_parallelism, :type => :numeric, :default => nil
12
12
  method_option :test_pattern, :type => :string, :default => nil
13
13
  method_option :force, :type => :boolean, :default => false
14
14
  method_option :machine, :type => :boolean, :default => false
15
- def spec
15
+ def spec(test_pattern=nil)
16
16
  machine_data = {}
17
17
 
18
18
  set_shell
@@ -27,21 +27,26 @@ class Tddium
27
27
 
28
28
  test_execution_params = {}
29
29
 
30
- user_data_file_path = get_remembered_option(options, :user_data_file, nil) do |user_data_file_path|
30
+ if user_data_file_path = options[:user_data_file]
31
31
  if File.exists?(user_data_file_path)
32
32
  user_data = File.open(user_data_file_path) { |file| file.read }
33
33
  test_execution_params[:user_data_text] = Base64.encode64(user_data)
34
34
  test_execution_params[:user_data_filename] = File.basename(user_data_file_path)
35
+ say Text::Process::USING_SPEC_OPTION[:user_data_file] % user_data_file_path
35
36
  else
36
37
  exit_failure Text::Error::NO_USER_DATA_FILE % user_data_file_path
37
38
  end
38
39
  end
39
40
 
40
- max_parallelism = get_remembered_option(options, :max_parallelism, nil) do |max_parallelism|
41
+ if max_parallelism = options[:max_parallelism]
41
42
  test_execution_params[:max_parallelism] = max_parallelism
43
+ say Text::Process::USING_SPEC_OPTION[:max_parallelism] % max_parallelism
44
+ end
45
+
46
+ test_pattern ||= options[:test_pattern]
47
+ if test_pattern
48
+ say Text::Process::USING_SPEC_OPTION[:test_pattern] % test_pattern
42
49
  end
43
-
44
- test_pattern = get_remembered_option(options, :test_pattern, nil)
45
50
 
46
51
  start_time = Time.now
47
52
 
@@ -62,8 +67,10 @@ class Tddium
62
67
 
63
68
  # Start the tests
64
69
  start_test_executions = call_api(:post, "#{Api::Path::SESSIONS}/#{session_id}/#{Api::Path::START_TEST_EXECUTIONS}", test_execution_params)
70
+
71
+ num_tests_started = start_test_executions["started"].to_i
65
72
 
66
- say Text::Process::STARTING_TEST % start_test_executions["started"]
73
+ say Text::Process::STARTING_TEST % num_tests_started.to_s
67
74
 
68
75
  tests_not_finished_yet = true
69
76
  finished_tests = {}
@@ -101,7 +108,7 @@ class Tddium
101
108
  end
102
109
 
103
110
  # If all tests finished, exit the loop else sleep
104
- if finished_tests.size == current_test_executions["tests"].size
111
+ if finished_tests.size >= num_tests_started
105
112
  tests_not_finished_yet = false
106
113
  else
107
114
  sleep(Default::SLEEP_TIME_BETWEEN_POLLS)
@@ -113,11 +120,7 @@ class Tddium
113
120
  say Text::Process::FINISHED_TEST % (Time.now - start_time)
114
121
  say "#{finished_tests.size} tests, #{test_statuses["failed"]} failures, #{test_statuses["error"]} errors, #{test_statuses["pending"]} pending"
115
122
 
116
- # Save the spec options
117
- write_suite(suite_details["suite"].merge({"id" => current_suite_id}),
118
- {"user_data_file" => user_data_file_path,
119
- "max_parallelism" => max_parallelism,
120
- "test_pattern" => test_pattern})
123
+ write_suite(suite_details["suite"].merge({"id" => current_suite_id}))
121
124
 
122
125
  exit_failure if test_statuses["failed"] > 0 || test_statuses["error"] > 0
123
126
  rescue TddiumClient::Error::Base
@@ -7,8 +7,11 @@ class Tddium
7
7
  desc "suite", "Register the current repo/branch, view/edit CI repos & deploy keys"
8
8
  method_option :edit, :type => :boolean, :default => false
9
9
  method_option :name, :type => :string, :default => nil
10
- method_option :pull_url, :type => :string, :default => nil
11
- method_option :push_url, :type => :string, :default => nil
10
+ method_option :ci_pull_url, :type => :string, :default => nil
11
+ method_option :ci_push_url, :type => :string, :default => nil
12
+ method_option :campfire_subdomain, :type=> :string, :default => nil
13
+ method_option :campfire_room, :type=> :string, :default => nil
14
+ method_option :campfire_token, :type=> :string, :default => nil
12
15
  method_option :test_pattern, :type => :string, :default => nil
13
16
  def suite
14
17
  set_default_environment
@@ -3,5 +3,5 @@ Copyright (c) 2011 Solano Labs All Rights Reserved
3
3
  =end
4
4
 
5
5
  module TddiumVersion
6
- VERSION = "0.10.0"
6
+ VERSION = "0.11.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tddium-preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-18 00:00:00.000000000 Z
12
+ date: 2011-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &14172440 !ruby/object:Gem::Requirement
16
+ requirement: &8804000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *14172440
24
+ version_requirements: *8804000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &14171680 !ruby/object:Gem::Requirement
27
+ requirement: &8798280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *14171680
35
+ version_requirements: *8798280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &14170980 !ruby/object:Gem::Requirement
38
+ requirement: &8797580 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *14170980
46
+ version_requirements: *8797580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: tddium_client
49
- requirement: &14170100 !ruby/object:Gem::Requirement
49
+ requirement: &8796740 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.1.1
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *14170100
57
+ version_requirements: *8796740
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: tddium_reporting
60
- requirement: &14169480 !ruby/object:Gem::Requirement
60
+ requirement: &8796080 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.0.6
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *14169480
68
+ version_requirements: *8796080
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &14169040 !ruby/object:Gem::Requirement
71
+ requirement: &8795600 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *14169040
79
+ version_requirements: *8795600
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &14168460 !ruby/object:Gem::Requirement
82
+ requirement: &8795080 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *14168460
90
+ version_requirements: *8795080
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: fakefs
93
- requirement: &14167740 !ruby/object:Gem::Requirement
93
+ requirement: &8794340 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *14167740
101
+ version_requirements: *8794340
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: simplecov
104
- requirement: &14167000 !ruby/object:Gem::Requirement
104
+ requirement: &8793600 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *14167000
112
+ version_requirements: *8793600
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rake
115
- requirement: &14166320 !ruby/object:Gem::Requirement
115
+ requirement: &8792920 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *14166320
123
+ version_requirements: *8792920
124
124
  description: ! 'tddium runs your rspec, cucumber, and test::unit tests in our managed
125
125
 
126
126
  cloud environment. You can run tests by hand, or enable our hosted CI to watch