-
Notifications
You must be signed in to change notification settings - Fork 508
METRON-2023 [UI] Covering Grok Parser Creation with Cypress tests #1350
Conversation
@@ -23,7 +23,7 @@ env: | |||
- SCRIPT="mvn surefire:test@unit-tests -T 2C" | |||
- SCRIPT="mvn surefire:test@integration-tests" | |||
- SCRIPT="mvn clean site --projects site-book" | |||
- SCRIPT="mvn test --projects metron-interface/metron-config,metron-interface/metron-alerts" | |||
- SCRIPT="./metron-interface/scripts/run-all-ui-test.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrated to bash script from maven. manven-frontend-plugin thrown error when tried to unzip Cypress.
@@ -53,8 +51,5 @@ before_cache: | |||
cache: | |||
timeout: 1000 | |||
directories: | |||
- $HOME/.npm-cache | |||
- $HOME/.npm-prefix | |||
- metron-interface/metron-config/node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrated to Travis CI's own node/npm instance managed by nvm. The above configs no longer needed.
@@ -1 +1 @@ | |||
v9.11.1 | |||
v10.15.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With .nvmrc we can pin down the node/npm version both on Travis and local.
Upgraded to the latest LTS node version.
"cypress:open": "cypress open", | ||
"cypress:ci": "ng build --prod && run-p --race start:ci cypress:run", | ||
"start:ci": "node ./scripts/alerts-server.js -c alerts_ui_cypress.yml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Npm scripts have been unified in the two UI project.
"tslint": "~5.0.0", | ||
"typescript": "~2.9.2", | ||
"yamljs": "^0.3.0" | ||
"typescript": "~2.9.2" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the simplification of the way we fire up UIs for testing in Travis, we're able to eliminate 5 of our dependencies with adding only one.
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the pom.xml to have our two UI's in the maven project tree (makes it easier to import etc.), but I removed the two UI from the install and test goals.
Also tried to upgrade to the latest maven-frontend-plugin 1.7.5 but it hasn't fixed the unzipping issue.
echo "| Checking Apache license headers... |" | ||
echo "└─────────────────────────────────────┘" | ||
./scripts/prepend_license_header.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, git recognized this change as a rename. It is actually a removal of a yml config file (belongs to our previous test server setup, no longer needed) and the addition of a shell scirpt.
"rawMessageStrategy": "DEFAULT", | ||
"rawMessageStrategyConfig": {} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response mock for GROK parser creation test.
"Ise": "org.apache.metron.parsers.ise.BasicIseParser", | ||
"GrokWebSphere": "org.apache.metron.parsers.websphere.GrokWebSphereParser", | ||
"Bro": "org.apache.metron.parsers.bro.BasicBroParser" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response mock for GROK parser creation test.
SCRIPTS_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
$SCRIPTS_ROOT/../node_modules/@angular/cli/bin/ng serve --proxy-config proxy.conf.json --aot $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, git recognized this change as a rename. It is actually a removal of a yml config file (belongs to our previous test server setup, no longer needed) and the addition of a shell script we used to fire up the UI locally.
echo " _/_/ " | ||
echo "" | ||
|
||
./metron-config/scripts/run-all-test.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is hard to distinguish the output of the two UI, therefore, I added the echos above.
<!-- Checkstyle is LGPL. We derive ours from their base, but don't ship it, so it's fine use. | ||
Since it is derived, we shouldn't get an Apache header --> | ||
<exclude>checkstyle.xml</exclude> | ||
<!-- Alerts UI e2e test data --> | ||
<exclude>e2e/mock-data/alerts_ui_e2e_index.data</exclude> | ||
<exclude>**/e2e/mock-data/alerts_ui_e2e_index.data</exclude> | ||
<!-- retry files generated by Ansible during a failure --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without wildcards, the rat check failed to me on my local machine. With this change, it works both local and on Travis.
@tiborm Could you give a brief explanation of your research and testing that led to this change? |
@sardell Our build jobs started to fail at some point. The cause of the failure was that mvn install was unable to execute unzipping in Cypress post install script without a mysterious error. Few other guys experienced similar issues.
I found cypress reacted on the issue at the time I writeing this. But not yet proven fix out there. |
Please also consider that the Trevis issue was experienced first when added cypress to Config UI (as part of the migration from protractor). Having it only in a single project (Alert UI in this case) show no issues. |
@tiborm Thanks for the explanation. EDIT: I think we have to have that plugin in order to successfully run a build outside of Travis. |
@sardell You are right. I investigated all the possible ways to extract cypress tests from the maven loop but leave the build, unit testing as it is. But no matter what we do 'npm ci' command (like you pointed out) will be executed by maven and that's going to fail if we add cypress to more than one UI project. For now, I should close this. And hoping for some fix in the future from maven or yauzl. |
Contributor Comments
In this PR I introducing Cypress in Config UI and adding a Cypress test to the Config UI to cover Grok Parser Creation. To do this I made a simplified common test setup across Config and Alert UI to bring them to the same platform.
I also had to remove maven-frontend-plugin to fix issues we faced with on Travis while we tried to add cypress to Config UI project.
The list of changes are the following:
Steps to validate
Please check build logs in Travis CI to see the output of the UI tests.
https://travis-ci.org/apache/metron/jobs/502040547
Under this link you can find a build failing where I intentionally broke a test to see whether it breaks the build too.
Pull Request Checklist
Thank you for submitting a contribution to Apache Metron.
Please refer to our Development Guidelines for the complete guide to follow for contributions.
Please refer also to our Build Verification Guidelines for complete smoke testing guides.
In 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.