Skip to content

Commit da2b9ca

Browse files
committed
Modify jenkins steps to adjust 4.0 change
1 parent 00a537f commit da2b9ca

File tree

2 files changed

+100
-3
lines changed

2 files changed

+100
-3
lines changed

features/step_definitions/images/jenkins.rb

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@
6161
cb.jenkins_major_version = version
6262

6363
# wait for actual startup as in 3.10+ it is slow on only 512M pod
64-
timeout = 300
6564
if version == "1"
65+
timeout = 300
6666
wait_string = "Jenkins is fully up and running"
6767
else
6868
# seems like recent jenkins has a delay caused by admin monitor
6969
# here trying to wait for it's operation to finish
7070
# possible remedy is DISABLE_ADMINISTRATIVE_MONITOR or give mor RAM to pod
71+
timeout = 600
7172
wait_string = "Finished Download metadata."
7273
end
7374
started = wait_for(timeout) {
@@ -139,3 +140,63 @@
139140

140141
step 'the step should succeed'
141142
end
143+
144+
Given /^I have a jenkins server with above 40 cluster$/ do
145+
146+
last_startup_check = monotonic_seconds
147+
if !user.password?
148+
step %Q/I run the :new_app client command with:/, table(%{
149+
| p | ENABLE_OAUTH=false |
150+
| template | jenkins-persistent |
151+
})
152+
step 'the step should succeed'
153+
else
154+
step %Q/I run the :new_app client command with:/, table(%{
155+
| template | jenkins-persistent |
156+
})
157+
step 'the step should succeed'
158+
end
159+
160+
step 'I wait for the "jenkins" service to become ready up to 600 seconds'
161+
cb.jenkins_svc = service
162+
cache_resources *service.pods, route("jenkins", service("jenkins"))
163+
cb.jenkins_pod = pod
164+
cb.jenkins_route = route
165+
cb.jenkins_dns = cb.jenkins_route.dns
166+
cb.jenkins_major_version = 2
167+
168+
timeout = 600
169+
wait_string = "Finished Download metadata."
170+
171+
started = wait_for(timeout) {
172+
since = monotonic_seconds - last_startup_check
173+
res = user.cli_exec(
174+
:logs,
175+
resource_name: cb.jenkins_pod.name,
176+
since: "#{since.to_i + 5}s",
177+
_quiet: true
178+
)
179+
last_startup_check += since
180+
res[:response].include? wait_string
181+
}
182+
if started
183+
logger.info "Jenkins log line found: #{wait_string}"
184+
else
185+
raise "Jenkins failed to start within #{timeout} seconds"
186+
end
187+
end
188+
189+
Given /^I log into jenkins with above 40 cluster$/ do
190+
if user.password?
191+
step %Q/I perform the :jenkins_multi_oauth_login web action with:/, table(%{
192+
| username | <%= user.name %> |
193+
| password | <%= user.password %> |
194+
})
195+
else
196+
step %Q/I perform the :jenkins_standard_login web action with:/, table(%{
197+
| username | admin |
198+
| password | password |
199+
})
200+
end
201+
step 'the step should succeed'
202+
end

lib/rules/web/images/jenkins_2/jenkins_2.xyaml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,16 +552,52 @@ jenkins_standard_login:
552552
name: j_password
553553
op: send_keys <password>
554554
type: input
555+
scripts:
556+
- command: return document.getElementsByName("Submit")[0].click()
557+
expect_result: ~
558+
action: jenkins_verify_logged_in
559+
560+
jenkins_oauth_login:
561+
url: /securityRealm/commenceLogin?from=%2F
562+
scripts:
563+
- command: |
564+
var Logtext = document.getElementsByClassName("btn btn-lg btn-primary")[0]
565+
if (typeof(Logtext) == "undefined"){
566+
return true;
567+
}
568+
Logtext.click();
569+
return true;
570+
expect_result: true
555571
elements:
556572
- selector:
557-
id: yui-gen1-button
573+
id: inputUsername
574+
op: send_keys <username>
575+
type: input
576+
- selector:
577+
id: inputPassword
578+
op: send_keys <password>
579+
type: input
580+
- selector:
581+
text: Log In
558582
op: click
559583
type: button
584+
scripts:
585+
- command: |
586+
var Auth = document.getElementsByName("approve")[0]
587+
if (typeof(Auth) == "undefined"){
588+
return true;
589+
}
590+
Auth.click();
591+
return true;
592+
expect_result: true
560593
action: jenkins_verify_logged_in
561594

562-
jenkins_oauth_login:
595+
jenkins_multi_oauth_login:
563596
url: /securityRealm/commenceLogin?from=%2F
564597
scripts:
598+
- command: return document.getElementsByClassName("idp")[1].click()
599+
expect_result: ~
600+
scripts:
565601
- command: |
566602
var Logtext = document.getElementsByClassName("btn btn-lg btn-primary")[0]
567603
if (typeof(Logtext) == "undefined"){

0 commit comments

Comments
 (0)