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

Fix flaky respository server controller unit test #2223

Merged
merged 2 commits into from
Jul 24, 2023
Merged

Conversation

kale-amruta
Copy link
Contributor

@kale-amruta kale-amruta commented Jul 24, 2023

Change Overview

The repository server CR state changes to Pending when next reconcilation executes, so that the process starts again. Hence whenever the CR state is changed to Failed a reconcilation is run and the status of the CR is changed to Pending. In the unit tests, after waitOnRepositoryServerState is called if we receive a Failed state, we return to the calling function. After that we get the latest repository Server CR object using kubecli.GET function. Meanwhile if the reconcilation is run, the repository server CR's status is changed to Pending. Hence the tests fail with following error:

repositoryserver_controller_test.go:377: 
        error:
          values are not equal
        got:
          "Pending"
        want:
          "Failed"
        stack:

This PR fixes the flakyness by returning the status field's value at the moment when its changed to Failed rather than depending on the next kubecli.GET call

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • fixes #issue-number

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Test output:

https://gist.github.com/kale-amruta/ade024a88ba9b982bed4f79d9b3efea8

@github-actions
Copy link
Contributor

Thanks for submitting this pull request 🎉. The team will review it soon and get back to you.

If you haven't already, please take a moment to review our project contributing guideline and Code of Conduct document.

@infraq infraq added this to In Progress in Kanister Jul 24, 2023
@kale-amruta kale-amruta changed the title Fix flaky respository server controller test Fix flaky respository server controller unit test Jul 24, 2023
Kanister automation moved this from In Progress to Reviewer approved Jul 24, 2023
@mergify mergify bot merged commit 151cfbf into master Jul 24, 2023
14 checks passed
Kanister automation moved this from Reviewer approved to Done Jul 24, 2023
@mergify mergify bot deleted the fixFlakyTest branch July 24, 2023 10:41
mabhi pushed a commit that referenced this pull request Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants