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

Wazuh Dashboard: PoC - tests #32

Closed
AlexRuiz7 opened this issue Mar 28, 2023 · 4 comments
Closed

Wazuh Dashboard: PoC - tests #32

AlexRuiz7 opened this issue Mar 28, 2023 · 4 comments
Labels
level/task Task issue request/operational Operational request

Comments

@AlexRuiz7
Copy link
Member

Description

Cypress tests are hosted into a different repository, and the CI workflow is configured to use pull requests' base branch as reference to checkout the tests' repository.

As we do not want to fork the tests' repository for the time being, a possible solution would be to patch the Cypress workflow to checkout the tests's repository at the version we want. given as an input (file, env variable...).

This issue aims to provide a proof of concept.

@AlexRuiz7
Copy link
Member Author

AlexRuiz7 commented Mar 28, 2023

Proof of concept: using GitHub vars

  • Set up an environment variable at repository level
    Possible security concerns: variables render unmasked in your build outputs, but this isn't sensitive information.
  • Read the variable in Actions
  • Update the action ( 4d5f273, 923c132 )
     diff --git a/.github/workflows/cypress_workflow.yml b/.github/workflows/cypress_workflow.yml
     index 41b9d46aa3..53c39eb532 100644
     --- a/.github/workflows/cypress_workflow.yml
     +++ b/.github/workflows/cypress_workflow.yml
     @@ -13,6 +13,7 @@ env:
        OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot'
        SPEC: 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js,'
        CYPRESS_ENV: 'env CYPRESS_VISBUILDER_ENABLED=true '
     +  OPENSEARCH_VERSION: ${{ vars.OPENSEARCH_VERSION }}
     
     jobs:
        cypress-tests:
    

@AlexRuiz7 AlexRuiz7 linked a pull request Mar 28, 2023 that will close this issue
AlexRuiz7 added a commit that referenced this issue Mar 28, 2023
Forgot to actually use the env variable
@AlexRuiz7
Copy link
Member Author

AlexRuiz7 commented Mar 29, 2023

There are good and bad news. Good news is that the Cypress tests are launched correctly, hence confirming this PoC. Bad news is that most of the tests do fail (8/12).

(TODO)
At first, the changes to the action were not taking into account by, so I had to push them to the main branch as well. I expected the action of the base branch to be used, but this doesn't seem to be the case. I'll dive deeper in this matter.

In reference to the failed Cypress tests, they do fail by 3 reasons:

  • Due to actual errors: something is broken and needs fixing.
  • Due to our changes: tests need to be skipped until we find a better solution. In Cypress, this might be possible using the excludePatten option. In Jest however, this cannot be done as only test files or paths can be excluded, but not specific tests. See testMatch, testPathIgnorePattern and testRegex.
    We could either skip more tests than the necessary, or create a single test per file. In this case, we would need to manually divide all the tests, handle the errors and keep dividing them each time we receive new tests from upstream. None of the options are good, so we'll simply whitelist them and accept these tests to fail, watching no other tests than these fail.
  • Due to timeout: the tests did not end in the expected time interval. Needs fixing.

These 3 cases will be treated in depth and one-by-one in a particular issue #34.

@AlexRuiz7
Copy link
Member Author

AlexRuiz7 commented Mar 29, 2023

I'll try to fix some of these tests and create a 2nd pull request to trigger a new run, in order to:

  • check if the excludePatten option works.
  • double check this PoC works.

@AlexRuiz7 AlexRuiz7 added level/task Task issue request/operational Operational request and removed untriaged labels Apr 19, 2023
@AlexRuiz7
Copy link
Member Author

The PoC is working as stated in #33, and implemented in #34.

@AlexRuiz7 AlexRuiz7 mentioned this issue Apr 19, 2023
8 tasks
@AlexRuiz7 AlexRuiz7 mentioned this issue Apr 28, 2023
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue request/operational Operational request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant