Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Started implementing the build-timeout test until I hit a roadblock w…

…ith the plugin itself :(
  • Loading branch information...
commit 33770dda9ca8459ee0dcbd8e2cc6be5064e0f59a 1 parent bcdd211
@rtyler rtyler authored
View
20 features/plugins/buildtimeout.feature
@@ -4,13 +4,15 @@ Feature: Fail builds that take too long
I want to set timeouts with the build-timeout plugin to abort or
fail builds that exceed specied timeout values
- @wip @realupdatecenter
- Scenario: Fail a blocked job
- Given I have installed the "build-timeout" plugin
- And a job
- When I configure the job
- And I add a script build step to run "sleep 20"
- And I set the build timeout to 5 seconds
- When I run the job
- Then the build should fail
+ # NOTE: The build-timeout plugin doesn't allow timeouts less than 3 minutes
+ # in duration, so I'm just going to leave this commented out :(
+ #@wip @realupdatecenter
+ #Scenario: Fail a blocked job
+ # Given I have installed the "build-timeout" plugin
+ # And a job
+ # When I configure the job
+ # And I add a script build step to run "sleep 10000"
+ # And I set the build timeout to 3 minutes
+ # When I run the job
+ # Then the build should fail
View
9 features/step_definitions/buildtimeout_steps.rb
@@ -1,4 +1,9 @@
-When /^I set the build timeout to (\d+) seconds$/ do |timeout|
- pending # express the regexp above with the code you wish you had
+When /^I set the build timeout to (\d+) minutes$/ do |timeout|
+ # Check the [x] Abort the build if it's stuck
+ find((:xpath, "//input[@name='hudson-plugins-build_timeout-BuildTimeoutWrapper']").set(true)
+
+
+ choose 'build-timeout.timeoutType'
+ fill_in '_.timeoutMunites', :with => timeout
end
View
40 test/selenium/plugins/buildtimeout.rb
@@ -1,40 +0,0 @@
-require File.dirname(__FILE__) + "/../lib/base"
-require File.dirname(__FILE__) + "/../pageobjects/newjob"
-require File.dirname(__FILE__) + "/../pageobjects/job"
-require File.dirname(__FILE__) + "/../pageobjects/pluginmanager"
-
-
-class BuildTimeoutPluginTests < JenkinsSeleniumTest
- def setup
- super
-
- PluginManager.new(@driver, @base_url).install_plugin('build-timeout')
- restart_jenkins
-
- @job_name = "Selenium_Timeout_Test_Job"
- NewJob.create_freestyle(@driver, @base_url, @job_name)
- @job = Job.new(@driver, @base_url, @job_name)
- end
-
- def test_git_clone
- @job.configure do
- timeout_box = @driver.find_element(:xpath, "//input[@name='hudson-plugins-build_timeout-BuildTimeoutWrapper']")
- timeout_box.click
-
- timeout_value = @driver.find_element(:xpath, "//input[@name='build-timeout.timeoutMinutes']")
- timeout_value.send_keys "1"
-
- failBuild = @driver.find_element(:xpath, "//input[@name='build-timeout.failBuild']")
- failBuild.click
-
- @job.add_build_step "sleep 120"
- end
-
- @job.queue_build
- sleep 60
-
- build = @job.build(1)
-
- assert build.failed?, "The build should have failed!"
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.