Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore ATH run against containerized selenium #556

Merged

Conversation

olivergondza
Copy link
Member

@olivergondza olivergondza commented Jan 28, 2020

Permit ATH to utilize selenium containers to host browser, driver and selenium server. This si tangential to what ath-container do, but it integrates nicely with buildPlugin.

This is intended to be a way to use ATH from plugins source code.

Downstream PRs:

@olivergondza olivergondza requested review from Vlatombe, amuniz and vilacides and removed request for Vlatombe February 5, 2020 07:53
@olivergondza
Copy link
Member Author

@jenkinsci/code-reviewers && @jglick, please have a look. Mainly at the documentation part: https://github.com/olivergondza/acceptance-test-harness/blob/prototype-containerized-selenium/docs/EXTERNAL.md (note the example repositories do not have the change merged jet)

Copy link
Member

@amuniz amuniz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice job @olivergondza!!

return "Kill and remove selenium container";
}
};
Thread.sleep(3000); // Give the container and selenium some time to spawn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit fragile. Isn't there a way to check if the container fully started? Maybe checking some logs entries?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way is to poll for a 200 response for up to some time. That will save some time if it's faster than 3000

@jglick
Copy link
Member

jglick commented Feb 7, 2020

At one point @oleg-nenashev had been playing with related stuff.

@olivergondza
Copy link
Member Author

Thanks for the reviews so far. I will proceed with integrating this by the end of the week provided there is no negative feedback.

@olivergondza olivergondza merged commit 8a5acca into jenkinsci:master Feb 14, 2020
@olivergondza olivergondza deleted the prototype-containerized-selenium branch February 14, 2020 09:07
@uhafner
Copy link
Member

uhafner commented Feb 18, 2020

I tried to follow your example for the warnings plugin. I copied the tests to a new module and started them, but the tests do not start up due to an exception. I downloaded the kerberos plugin and here I also get the same exception:

[ERROR] com.sonymobile.jenkins.plugins.kerberossso.KerberosSsoTest.explicitTicketAuth  Time elapsed: 4.938 s  <<< ERROR!
com.google.inject.ProvisionException: 
Unable to provision, see the following errors:

1) Error in custom provider, org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'Ullis-MBP-3.fritz.box', ip: '2003:cf:f32:d300:402b:fd9d:8528:49d0%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.3', java.version: '1.8.0_242'
Driver info: driver.version: RemoteWebDriver
  at org.jenkinsci.test.acceptance.FallbackConfig.createWebDriver(FallbackConfig.java:293) (via modules: org.jenkinsci.test.acceptance.guice.World -> com.google.inject.util.Modules$OverrideModule -> com.google.inject.util.Modules$OverrideModule -> org.jenkinsci.test.acceptance.FallbackConfig)
  at org.jenkinsci.test.acceptance.FallbackConfig.createWebDriver(FallbackConfig.java:293) (via modules: org.jenkinsci.test.acceptance.guice.World -> com.google.inject.util.Modules$OverrideModule -> com.google.inject.util.Modules$OverrideModule -> org.jenkinsci.test.acceptance.FallbackConfig)
  while locating org.openqa.selenium.WebDriver
    for field at org.jenkinsci.test.acceptance.junit.DiagnosticRule.driver(DiagnosticRule.java:19)
  while locating org.jenkinsci.test.acceptance.junit.DiagnosticRule

1 error
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: 
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'Ullis-MBP-3.fritz.box', ip: '2003:cf:f32:d300:402b:fd9d:8528:49d0%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.3', java.version: '1.8.0_242'
Driver info: driver.version: RemoteWebDriver
Caused by: java.net.ConnectException: Failed to connect to /127.0.0.1:64632
Caused by: java.net.ConnectException: Connection refused (Connection refused)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   KerberosSsoTest.basicAuth » Provision Unable to provision, see the following e...
[ERROR]   KerberosSsoTest.explicitBasicAuth » Provision Unable to provision, see the fol...
[ERROR]   KerberosSsoTest.explicitTicketAuth » Provision Unable to provision, see the fo...
[ERROR]   KerberosSsoTest.kerberosTicket » Provision Unable to provision, see the follow...
[ERROR]   KerberosSsoTest.kerberosTicketWithBasicAuthEnabled » Provision Unable to provi...
[ERROR]   KerberosSsoTest.kerberosTicketWithBasicAuthEnabledJcasc » Provision Unable to ...
[INFO] 
[ERROR] Tests run: 6, Failures: 0, Errors: 6, Skipped: 0

Is macOS not supported for these kind of tests? ATH is running fine on macOS though.

@olivergondza
Copy link
Member Author

@uhafner, good point, i have not kept macos in mind. I suppose native host networking will never work on macos and win so we probably have to rethink that. (This depend on native host networking as the browser inside container needs to be able to access Jenkins running on the host)

@jglick
Copy link
Member

jglick commented Feb 19, 2020

the browser inside container needs to be able to access Jenkins running on the host

FWIW I find it more straightforward to just run mvn test, and thus (with the default controller) Jenkins, inside a sibling container as well.

@olivergondza
Copy link
Member Author

@jglick, wrapping Jenkins to a container (too) has a problem that it needs to reach to MockUpdateCenter (at least) running inside surefire process (on the host). Moving surefire into a container (the same or different from Jenkins) is something I have abandoned for its hideousness:

So yeah, this is something to explore.

@uhafner
Copy link
Member

uhafner commented Feb 20, 2020

I see. I can run the tests locally on macOS using the standard mechanism (e.g. JUT server), that works even from IntelliJ. During the CI build of my plugin I can switch to your new approach...

@olivergondza
Copy link
Member Author

@uhafner, that might be the simplest way to go on Mac. Note just changing the variable from <BROWSER>firefox-container</BROWSER> to <BROWSER>firefox</BROWSER> should do the trick.

@jglick
Copy link
Member

jglick commented Feb 24, 2020

wrapping Jenkins to a container (too) has a problem that it needs to reach to MockUpdateCenter (at least) running inside surefire process (on the host). Moving surefire into a container (the same or different from Jenkins)

FWIW I was not proposing any of these things. Rather, moving the entire mvn test inside a (maven:3.6.3-jdk-8, e.g.) container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants