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

chore: Add tests for pause functionality in rollout package #2772

Merged
merged 1 commit into from
May 21, 2023

Conversation

zhaque44
Copy link
Contributor

  1. The TestHasAddPause checks the behavior of the HasAddPause() function in the pauseContext struct. It creates a pauseContext instance with an empty v1alpha1.RolloutStatus and an empty list of pause conditions. It sets one addPauseReason with the value v1alpha1.PauseReasonCanaryPauseStep with an empty list for removePauseReasons. The test then calls the function on the pauseContext and asserts that the result is true.
  2. The test TestHasAddPauseNoReasons is basically the unhappy path for the HasAddPause() function. It creates a pauseContext instance with an empty v1alpha1.RolloutStatus and an empty list of pause conditions. It sets both the addPauseReasons and removePauseReasons lists as empty. The test then calls the function and asserts that the result is false.
  3. The test TestCalculatePauseStatus checks the behavior of the CalculatePauseStatus() function in the pauseContext struct. It creates a pauseContext instance with an empty v1alpha1.RolloutStatus and an empty list of pause conditions. It sets one addPauseReason with the value v1alpha1.PauseReasonCanaryPauseStep and keeps an empty list for removePauseReasons. The test creates an empty newStatus variable of type v1alpha1.RolloutStatus and calls the CalculatePauseStatus(newStatus) method.
  4. The test TestCalculatePauseStatusRemovePause is the unhappy path of the CalculatePauseStatus() function with assertions.
  5. The TestCompletedBlueGreenPause test checks the behavior of the CompletedBlueGreenPause() function for a Blue-Green deployment strategy. It creates a pauseContext instance with a v1alpha1.Rollout having a Blue-Green strategy, ControllerPause is set to true, with one pause condition v1alpha1.PauseReasonBlueGreenPause & ScaleUpPreviewCheckPoint is set to true. The test then calls the function and asserts that the result is true.
  6. The test TestCompletedBlueGreenPauseAutoPromotionDisabled is the unhappy path of the CompletedBlueGreenPause() function with assertions.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2023

Go Published Test Results

1 960 tests   1 960 ✔️  2m 35s ⏱️
   118 suites         0 💤
       1 files           0

Results for commit 60f9121.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented May 11, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (13b988e) 81.64% compared to head (60f9121) 81.64%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2772   +/-   ##
=======================================
  Coverage   81.64%   81.64%           
=======================================
  Files         133      133           
  Lines       20178    20178           
=======================================
  Hits        16475    16475           
  Misses       2849     2849           
  Partials      854      854           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2023

E2E Tests Published Test Results

    4 files      4 suites   3h 27m 26s ⏱️
  96 tests   81 ✔️   5 💤 10
402 runs  365 ✔️ 20 💤 17

For more details on these failures, see this check.

Results for commit 60f9121.

♻️ This comment has been updated with latest results.

@zachaller zachaller force-pushed the rollout-pkg-tests branch from 323fde5 to 60f9121 Compare May 15, 2023 00:11
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@zhaque44
Copy link
Contributor Author

@zachaller question is this PR good to go? The e2e tests failed, are those tests flaky I doubt that the tests I added caused them to fail

@zachaller zachaller merged commit 09f6267 into argoproj:master May 21, 2023
@zhaque44 zhaque44 deleted the rollout-pkg-tests branch November 21, 2024 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants