Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit 93c8e8c

Browse files
committed
Test case execution fixes
1 parent 0ddce99 commit 93c8e8c

File tree

6 files changed

+52
-15
lines changed

6 files changed

+52
-15
lines changed

lib/vagrant-openshift/action/run_tests.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def call(env)
3838
cmd_opts += "#{k}=#{v} "
3939
end
4040
cmd = "cd #{Constants.build_dir + 'builder'}; #{scl_wrapper(is_fedora,'rake run_tests ' + cmd_opts)} "
41-
_,_,rc = sudo(env[:machine], cmd, {timeout: 0})
41+
_,_,env[:test_exit_code] = sudo(env[:machine], cmd, {timeout: 0, fail_on_error: false})
4242

4343
@app.call(env)
4444
end

lib/vagrant-openshift/action/yum_update.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def initialize(app, env)
2727

2828
def call(env)
2929
sudo env[:machine], "rm -rf /etc/yum.repos.d/openshift-origin.repo"
30-
sudo env[:machine], "yum clean all; yum -y update --exclude=kernel*"
30+
sudo env[:machine], "yum clean all;"
31+
sudo env[:machine], "yum -y update --exclude=kernel*", {retries: 3, fail_on_error: false}
3132

3233
env[:machine].ui.warn "Increasing YUM cache timeout to 9999999. You will need manually clear cache to get additonal updates."
3334
remote_write(env[:machine], "/etc/yum.conf") {
@@ -39,7 +40,7 @@ def call(env)
3940
logfile=/var/log/yum.log
4041
exactarch=1
4142
obsoletes=1
42-
gpgcheck=1
43+
gpgcheck=0
4344
plugins=1
4445
installonly_limit=3
4546

lib/vagrant-openshift/command/test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def execute
6363
options[:download] = true
6464
end
6565

66+
o.on("--fixme", "Run known broken tests to verify test fixes") do |f|
67+
options[:fixme] = true
68+
end
69+
6670
o.on("-h", "--help", "Show this message") do |f|
6771
options[:help] = true
6872
end

lib/vagrant-openshift/helper/command_helper.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ def sudo(machine, command, options={})
2727
stdout = []
2828
stderr = []
2929
rc = -1
30-
options[:timeout] ||= 60*10
31-
options[:retries] ||= 1
30+
options[:timeout] = 60*10 unless options.has_key? :timeout
31+
options[:retries] = 1 unless options.has_key? :retries
32+
options[:fail_on_error] = true unless options.has_key? :fail_on_error
3233

3334
(1..options[:retries]).each do |retry_count|
3435
begin
@@ -50,10 +51,14 @@ def sudo(machine, command, options={})
5051
rescue Timeout::Error
5152
machine.env.ui.warn "Timeout occured while running ssh/sudo command: #{command}"
5253
rc = -1
54+
rescue Exception => e
55+
machine.env.ui.warn "Error while running ssh/sudo command: #{command}"
56+
rc ||= -1
5357
end
5458

5559
break if rc == 0
5660
end
61+
exit rc if options[:fail_on_error] && rc != 0
5762

5863
[stdout, stderr, rc]
5964
end

lib/vagrant-openshift/templates/builder/Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,16 @@ end
174174

175175
task :run_tests do
176176
options = {}
177+
options[:fixme] = ENV["fixme"] == "true"
177178
if ENV["extended"] == "true"
178179
options[:node_extended] = ENV["node"] == "true"
179180
options[:broker_extended] = ENV["broker"] == "true"
180181
options[:rhc_extended] = ENV["rhc"] == "true"
181182
options[:console_extended] = ENV["console"] == "true"
183+
options[:exclude_node] = true
184+
options[:exclude_broker] = true
185+
options[:exclude_rhc] = true
186+
options[:exclude_console] = true
182187
else
183188
options[:exclude_node] = ENV["node"] != "true"
184189
options[:exclude_broker] = ENV["broker"] != "true"

lib/vagrant-openshift/templates/builder/lib/test.rb

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,43 @@ def test(options)
2929
(1..4).each do |i|
3030
test_queues[i-1] << build_cucumber_command("REST API Group #{i}", ["@broker_api#{i}"])
3131
end
32+
test_queues[0] << build_rake_command("OpenShift Broker Domain System", "cd /data/openshift-test/broker; rake test:domain_system_test")
3233
test_queues[2] << build_rake_command("OpenShift Broker Functionals Ext", "cd /data/openshift-test/broker; rake test:functionals_ext")
34+
test_queues[2] << build_rake_command("OpenShift Broker Integration Ext", "cd /data/openshift-test/broker; rake test:integration_ext")
35+
test_queues[0] << build_rake_command("OpenShift Broker Application System", "cd /data/openshift-test/broker; rake test:application_system_test")
36+
test_queues[2] << build_rake_command("OpenShift Broker Cartridge System", "cd /data/openshift-test/broker; rake test:cartridge_system_test")
3337
end
3438

3539
if options[:node_extended]
3640
(1..3).each do |i|
3741
test_queues[i-1] << build_cucumber_command("Extended Runtime Group #{i}", ["@runtime_extended#{i}"])
3842
end
43+
test_queues[3] << build_rake_command("OpenShift Runtime Functionals Ext", "cd /data/openshift-test/node; rake ext_func_test")
3944
end
4045

4146
if options[:rhc_extended]
42-
test_queues[0] << build_cucumber_command("RHC Extended", ["@rhc_extended"])
43-
test_queues[1] << build_cucumber_command("RHC Integration",[],
47+
test_queues[0] << build_cucumber_command("RHC Integration",[],
4448
{"RHC_SERVER" => "broker.example.com", "RHC_DOMAIN" => "example.com"},
45-
nil,"/data/openshift-test/rhc/features")
49+
nil,"/data/openshift-test/rhc/cucumber")
4650
end
4751

48-
#timeout = @@SSH_TIMEOUT
49-
#timeout = @@SSH_TIMEOUT_OVERRIDES[options.include_cucumber] if not @@SSH_TIMEOUT_OVERRIDES[options.include_cucumber].nil?
50-
#test_queues[0] << build_cucumber_command(options.include_cucumber, [], {}, nil, nil, options.include_cucumber)
51-
5252
unless options[:exclude_broker]
53+
test_queues[0] << build_rake_command("OpenShift Broker Sanity", "cd /data/openshift-test/broker; rake test:sanity", {}, false) if options[:fixme]
5354
test_queues[3] << build_rake_command("OpenShift Broker Units", "cd /data/openshift-test/broker; rake test:units", {}, false)
5455
test_queues[0] << build_rake_command("OpenShift Broker Integration", "cd /data/openshift-test/broker; rake test:integration", {}, false)
5556
test_queues[2] << build_rake_command("OpenShift Broker Functional", "cd /data/openshift-test/broker; rake test:functionals", {}, false)
56-
#test_queues[1] << build_rake_command("OpenShift Admin Console Functional", "cd /data/openshift-test/broker; rake test:admin_console_functionals", {}, false)
57+
test_queues[1] << build_rake_command("OpenShift Admin Console Functional", "cd /data/openshift-test/broker; rake test:admin_console_functionals", {}, false) if options[:fixme]
5758
test_queues[3] << build_cucumber_command("Broker cucumber", ["@broker"])
5859
end
5960

6061
unless options[:exclude_node]
61-
test_queues[0] << build_rake_command("Runtime Functional", "cd /data/openshift-test/node; rake func_test", {}, false)
62-
test_queues[0] << build_rake_command("Runtime Unit", "cd /data/openshift-test/node; rake unit_test", {}, false)
62+
test_queues[0] << build_rake_command("Runtime Functional", "cd /data/openshift-test/node; rake essentials_test", {}, false)
63+
test_queues[1] << build_rake_command("Runtime Frontend Plugin ApacheDB", "cd /data/openshift-test/plugins/frontend/apachedb; rake test", {}, false)
64+
test_queues[2] << build_rake_command("Runtime Frontend Plugin Apache Mod Rewrite", "cd /data/openshift-test/plugins/frontend/apache-mod-rewrite; rake test", {}, false)
65+
test_queues[3] << build_rake_command("Runtime Frontend Plugin Apache Vhost", "cd /data/openshift-test/plugins/frontend/apache-vhost; rake test", {}, false)
66+
test_queues[0] << build_rake_command("Runtime Frontend Plugin NodeJS Websocket", "cd /data/openshift-test/plugins/frontend/nodejs-websocket; rake test", {}, false)
67+
test_queues[1] << build_rake_command("Runtime Frontend Plugin Haproxy SNI Proxy", "cd /data/openshift-test/plugins/frontend/haproxy-sni-proxy; rake test", {}, false)
68+
test_queues[2] << build_rake_command("Runtime Unit", "cd /data/openshift-test/node; rake unit_test", {}, false)
6369
(1..4).each do |i|
6470
test_queues[i-1] << build_cucumber_command("Runtime Group #{i.to_s}", ["@runtime#{i.to_s}"])
6571
end
@@ -68,8 +74,24 @@ def test(options)
6874
unless options[:exclude_rhc]
6975
if @is_fedora
7076
test_queues[0] << build_rake_command("RHC Spec", 'cd /data/openshift-test/rhc; bundle install --local && bundle exec rake spec', {"SKIP_RUNCON" => 1}, false)
77+
test_queues[0] << build_rake_command("RHC Features", %{
78+
cd /data/openshift-test/rhc;
79+
export TEST_INSECURE=1;
80+
export TEST_RANDOM_USER=1;
81+
export RHC_SERVER=broker.example.com;
82+
export RHC_DOMAIN=example.com;
83+
bundle install --local && bundle exec rspec features/*_feature.rb
84+
}, {}, false)
7185
else
7286
test_queues[0] << build_rake_command("RHC Spec", 'cd /data/openshift-test/rhc; bundle install --path=/tmp/rhc_bundle && bundle exec rake spec', {}, false)
87+
test_queues[0] << build_rake_command("RHC Features", %{
88+
cd /data/openshift-test/rhc;
89+
export TEST_INSECURE=1;
90+
export TEST_RANDOM_USER=1;
91+
export RHC_SERVER=broker.example.com;
92+
export RHC_DOMAIN=example.com;
93+
bundle install --path=/tmp/rhc_bundle && bundle exec rspec features/*_feature.rb
94+
}, {}, false)
7395
end
7496
end
7597

0 commit comments

Comments
 (0)