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

Simplify bazel saucelabs targets #34769

Open
wants to merge 3 commits into
base: master
from

Conversation

@gregmagolan
Copy link
Contributor

gregmagolan commented Jan 14, 2020

refactor: simplify bazel saucelabs targets using karma pre-test wrapper and shared saucelabs connection between tests

Add a sauce-service.sh script that manages the sauce-connect as a service which is used by the karma pre-test wrapper to start the service and have it be shared between multiple karma_web_test targets which run in serial.

The following scripts now use the new ./scripts/saucelabs/sauce-service.sh script:

  • ./scripts/saucelabs/start-tunnel.sh
  • ./scripts/saucelabs/stop-tunnel.sh
  • ./scripts/saucelabs/wait-for-tunnel.sh

./scripts/saucelabs/start-tunnel.sh no longer needs to be called as a background process as it starts up the service & returns.

For testing on saucelabs with bazel, bazel run //:sauce_service_setup is called before bazel test //:sauce_target. This setups up the process to start SauceConnect but does not start it until the start signal is received via the karma //:karma-sauce-connect wrapper target (which runs /scripts/saucelabs/start-and-wait-for-tunnel.sh)

NB: Bazel will kill any processes that a test starts up when that tests completes so in order to share a saucelabs connect tunnel between different tests the process must be started outside of Bazel. The sauce-service script thus has a setup
action which starts the process but does not start the tunnel. Each test (via //:karma-sauce-connect) then calls the start step which signals the previously started process to start the SauceConnect tunnel. If no tests are run (because they are all cached) then no SauceConnect tunnel is started. The script can be used without the setup step and start can just be called instead which will start the tunnel if it is not already started.

@googlebot googlebot added the cla: yes label Jan 14, 2020
@gregmagolan gregmagolan force-pushed the gregmagolan:karma_pre_test branch 8 times, most recently from 84494fa to 3106a5a Jan 14, 2020
@gregmagolan gregmagolan changed the title Bazel sauce labs POC Simplify bazel saucelabs targets Jan 14, 2020
@gregmagolan gregmagolan marked this pull request as ready for review Jan 14, 2020
@gregmagolan gregmagolan requested review from IgorMinar and angular/dev-infra-framework as code owners Jan 14, 2020
@ngbot ngbot bot added this to the needsTriage milestone Jan 14, 2020
@gregmagolan gregmagolan force-pushed the gregmagolan:karma_pre_test branch 11 times, most recently from 0a7cee0 to 167c359 Jan 14, 2020
@gregmagolan gregmagolan force-pushed the gregmagolan:karma_pre_test branch from a4327ef to d34e943 Jan 15, 2020
@gregmagolan gregmagolan force-pushed the gregmagolan:karma_pre_test branch 2 times, most recently from 630a0b7 to 65a29b6 Jan 15, 2020
@gregmagolan

This comment has been minimized.

Copy link
Contributor Author

gregmagolan commented Jan 15, 2020

Added cleanup tag to remind me to remove the temporary CircleCI config changes before merging

@gregmagolan gregmagolan force-pushed the gregmagolan:karma_pre_test branch 3 times, most recently from 956e63b to ac13bdc Jan 22, 2020
@gregmagolan gregmagolan requested a review from josephperrott Jan 22, 2020
@gregmagolan gregmagolan force-pushed the gregmagolan:karma_pre_test branch 5 times, most recently from fbed31f to 7690b60 Jan 22, 2020
gregmagolan added 3 commits Jan 13, 2020
…er and shared saucelabs connection between tests

Add a sauce-service.sh script that manages the sauce-connect as a service which is used by the karma pre-test wrapper to start the service.

The following scripts now use the new ./scripts/saucelabs/sauce-service.sh script:
- ./scripts/saucelabs/start-tunnel.sh
- ./scripts/saucelabs/stop-tunnel.sh
- ./scripts/saucelabs/wait-for-tunnel.sh

./scripts/saucelabs/start-tunnel.sh no longer needs to be called as a background process as it starts up the service & returns.

For testing on saucelabs with bazel, `bazel run //:sauce_service_setup` is called before `bazel test //:sauce_target`. This setups up the process to start SauceConnect but does not start it until the start signal is received via the karma `//:karma-sauce-connect` wrapper target (which runs `/scripts/saucelabs/start-and-wait-for-tunnel.sh`)

NB: Bazel will kill any processes that a test starts up when that tests completes so in order to share a saucelabs connect tunnel between different tests the process must be started outside of Bazel. The sauce-service script thus has a `setup`
action which starts the process but does not start the tunnel. Each test (via //:karma-sauce-connect) then calls the `start` step which signals the previously started process to start the SauceConnect tunnel. If no tests are run (because they are all cached) then no SauceConnect tunnel is started. The script can be used without the `setup` step and `start` can just be called instead which will start the tunnel if it is not already started.
…t wrapper and shared saucelabs connection between tests

Make caching work for saucelabs bazel tests
@gregmagolan gregmagolan force-pushed the gregmagolan:karma_pre_test branch from 7690b60 to b155a3d Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.