-
Notifications
You must be signed in to change notification settings - Fork 507
METRON-1958: Optimize Cypress to use best practices #1317
Conversation
Has this been tested in full dev? The I am going to test in full dev now and will report back. |
I confirmed this in full dev. The Alerts UI fails to start unless you add |
I opened a PR with the fix: sardell#16. |
Added dirPath property to alerts_ui.yml.j2 ambari template
@merrimanr Thanks for catching that and opening a PR with the fix. I just merged it into my branch. |
Thanks @sardell, this looks good to me. +1 |
I have a post-merge comment - I really like this change:
I've used this pattern for integration testing before and it makes repeat runs more reliable, ie by cleaning up before the tests run, if you cancel prior to tests finishing you are still able to re-run without worrying about old state. Also, if you run into a test failure, now you have data post-test run that you can dig into and investigate without modifying your test infrastructure ad-hoc. |
Contributor Comments
Link to the original ASF JIRA ticket: https://jira.apache.org/jira/browse/METRON-1958
As described in the ticket, we have a few anti-patterns in place right now in regard to our Cypress configuration. Through local testing, I believe this has led to the recent Travis failures in Pull Requests like #1308 and #1275.
Changes Included
Testing
Clone either #1308 and #1275 locally. From the command line, navigate to metron-interface/metron-alerts from the root of the project. Install npm dependencies by running
npm ci
. Then, runnpm run cypress:ci
. #1308 will always fail, and #1275 will intermittently fail.Once you've verified failure on either on of the PRs mentioned above, clone this PR locally. Merge it into #1308 or #1275, run
npm ci
, then runnpm run cypress:ci
. The tests should consistently pass now.Other Considerations
The Cypress team recommends the use of the
wait-on
orstart-server-and-test
modules to handle the flow of starting your server, starting Cypress and, once the tests complete, killing your server. However, since the next proposed Metron release is near and this PR will fix failing PRs needed for that release, I decided instead to continue using the npm-run-all module we were already using. Since the express server is so incredibly fast compared to the startup of Cypress, I felt the risk of a race condition happening would be extremely low and this was the best approach for now. I've created a ticket around the addition of the recommended modules to keep track of the task: https://jira.apache.org/jira/browse/METRON-1959In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
For all changes:
For code changes:
Have you included steps to reproduce the behavior or problem that is being changed or addressed?
Have you included steps or a guide to how the change may be verified and tested manually?
Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:
Have you written or updated unit tests and or integration tests to verify your changes?
If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
For documentation related changes:
Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via
site-book/target/site/index.html
:Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
It is also recommended that travis-ci is set up for your personal repository such that your branches are built there before submitting a pull request.