Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

chore: properly evaluate how tests are skipped on CI when checking modified files#1924

Merged
mdelapenya merged 5 commits intoelastic:masterfrom
mdelapenya:fix-ci-unit-tests
Dec 17, 2021
Merged

chore: properly evaluate how tests are skipped on CI when checking modified files#1924
mdelapenya merged 5 commits intoelastic:masterfrom
mdelapenya:fix-ci-unit-tests

Conversation

@mdelapenya
Copy link
Copy Markdown
Contributor

@mdelapenya mdelapenya commented Dec 17, 2021

What does this PR do?

This PR does two things:

  1. wraps the evaluation of the stack deployment stage in an anyOf block, so that is consistent with all other stages.
  2. extracts the logic to evaluate if the tests must be skipped to a single function. This function starts setting the SKIP_TESTS env var to false, and:
  • if there are only markdown files in the changeset, the it will set the env var SKIP_TESTS to true.
  • if the changeset contains at least one modified file matching certain paths (see the modified files in this PR), then it will set the SKIP_TESTS env var to false.

Why is it important?

The unit tests stage is constantly skipped.

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have run the Unit tests (make unit-test), and they are passing locally
  • I have run the End-2-End tests for the suite I'm working on, and they are passing locally
  • I have noticed new Go dependencies (run make notice in the proper directory)

Related issues

@mdelapenya mdelapenya added backport-v7.15.0 Automated backport with mergify backport-v7.16.0 Automated backport with mergify backport-v8.0.0 Automated backport with mergify labels Dec 17, 2021
@mdelapenya mdelapenya self-assigned this Dec 17, 2021
@mdelapenya mdelapenya requested a review from a team December 17, 2021 11:04
@mdelapenya mdelapenya marked this pull request as ready for review December 17, 2021 11:24
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Dec 17, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-12-17T12:36:21.558+0000

  • Duration: 36 min 41 sec

  • Commit: 2c73677

Test stats 🧪

Test Results
Failed 0
Passed 216
Skipped 0
Total 216

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

.ci/Jenkinsfile Outdated
def regexps = [ "^e2e/_suites/fleet/.*", "^e2e/_suites/helm/.*", "^e2e/_suites/kubernetes-autodiscover/.*", "^.ci/.*", "^cli/.*", "^e2e/.*\\.go", "^internal/.*\\.go" ]
setEnvVar("SKIP_TESTS", !isGitRegionMatch(patterns: regexps, shouldMatchAll: false))
}
script {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NIT:
IIRC, this unrequired when running a method

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yep, not needed

Copy link
Copy Markdown
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

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

My comments are NIT

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
@mdelapenya mdelapenya merged commit e438b87 into elastic:master Dec 17, 2021
mergify bot pushed a commit that referenced this pull request Dec 17, 2021
…dified files (#1924)

* chore: consistency

* chore: refactor how the evaluation of the skip_tests is done

* chore: use proper function name

* chore: remove non needed initialisation

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

* chore: call method without script block

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
(cherry picked from commit e438b87)
mergify bot pushed a commit that referenced this pull request Dec 17, 2021
…dified files (#1924)

* chore: consistency

* chore: refactor how the evaluation of the skip_tests is done

* chore: use proper function name

* chore: remove non needed initialisation

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

* chore: call method without script block

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
(cherry picked from commit e438b87)
mergify bot pushed a commit that referenced this pull request Dec 17, 2021
…dified files (#1924)

* chore: consistency

* chore: refactor how the evaluation of the skip_tests is done

* chore: use proper function name

* chore: remove non needed initialisation

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

* chore: call method without script block

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
(cherry picked from commit e438b87)
mdelapenya added a commit that referenced this pull request Dec 17, 2021
…dified files (#1924) (#1925)

* chore: consistency

* chore: refactor how the evaluation of the skip_tests is done

* chore: use proper function name

* chore: remove non needed initialisation

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

* chore: call method without script block

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
(cherry picked from commit e438b87)

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya added a commit that referenced this pull request Dec 17, 2021
…dified files (#1924) (#1927)

* chore: consistency

* chore: refactor how the evaluation of the skip_tests is done

* chore: use proper function name

* chore: remove non needed initialisation

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

* chore: call method without script block

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
(cherry picked from commit e438b87)

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya added a commit that referenced this pull request Dec 17, 2021
…dified files (#1924) (#1926)

* chore: consistency

* chore: refactor how the evaluation of the skip_tests is done

* chore: use proper function name

* chore: remove non needed initialisation

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

* chore: call method without script block

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
(cherry picked from commit e438b87)

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Jan 26, 2022
* main: (45 commits)
  feat: add CentOS 8 support (elastic#2034)
  fix: set default region for AWS cli (elastic#2053)
  chore: use Ansible's built-in replace instead of sed (elastic#2048)
  chore: split stack configuration and start into two tasks (elastic#2044)
  feat: enable SSH access to users for debugging cloud instances (elastic#2001)
  fix: use the right branch for 7.17 backports (elastic#2025)
  SLES15 enablement (elastic#2007)
  chore: bump stale agent for main (elastic#2014)
  Update `fetchBeatsBinary` to be reused in elastic-agent-poc (elastic#1984)
  chore: add resiliency when provisioning the stack (elastic#1990)
  chore: bump elastic-package to v0.32.1 (elastic#1959)
  feat: export Fetch&Download methods in the /pkg directory (elastic#1943)
  bump stack version 8.1.0-dbc834fd (elastic#1948)
  bump stack version 8.1.0-76902d39 (elastic#1946)
  chore: retire 7.15 adding 7.17 (elastic#1938)
  ci: use withAPMEnv (elastic#1917)
  Update main branch (elastic#1928)
  bump stack version 8.1.0-befff95a (elastic#1929)
  chore: properly evaluate how tests are skipped on CI when checking modified files (elastic#1924)
  bump stack version 8.1.0-60bffc32 (elastic#1921)
  ...
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Mar 30, 2022
* main:
  chore: retire 7.15 adding 7.17 (elastic#1938)
  ci: use withAPMEnv (elastic#1917)
  Update main branch (elastic#1928)
  bump stack version 8.1.0-befff95a (elastic#1929)
  chore: properly evaluate how tests are skipped on CI when checking modified files (elastic#1924)
  bump stack version 8.1.0-60bffc32 (elastic#1921)
  fix: add resiliency when an integration cannot be added to a policy (elastic#1914)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport-v7.15.0 Automated backport with mergify backport-v7.16.0 Automated backport with mergify backport-v8.0.0 Automated backport with mergify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit test stage is always skipped with "Waiting for run to start"

4 participants