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

change the utility function for getting default repository server CR in unit tests #2170

Merged
merged 104 commits into from
Jul 24, 2023

Conversation

kale-amruta
Copy link
Contributor

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

Change Overview

GetTestKopiaRepositoryServerCR function was returning a pointer to repository server CR spec. Since the function is getting called in each unit test to get the default CR, any changes made in any test in the spec of the CR were getting reflected in other tests as well since its a pointer to the object. This was failing few tests randomly, this PR changes the removes the pointer from the return type
This issue was incurred during adding tests in #2146 PR

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

@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 12, 2023
@kale-amruta kale-amruta changed the base branch from master to AddUnitTests July 12, 2023 12:27
@kale-amruta kale-amruta changed the title change the utility function for default repository server in unit tests change the utility function for getting default repository server CR in unit tests Jul 12, 2023
if podName and serviceName are not set even after the polling time
exceeds
Base automatically changed from AddUnitTests to master July 13, 2023 08:18
Copy link
Contributor

@ankitjain235 ankitjain235 left a comment

Choose a reason for hiding this comment

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

LGTM

Kanister automation moved this from In Progress to Reviewer approved Jul 18, 2023
@mergify mergify bot merged commit c854b9e into master Jul 24, 2023
15 checks passed
Kanister automation moved this from Reviewer approved to Done Jul 24, 2023
@mergify mergify bot deleted the repositoryServerUnitTestsChange branch July 24, 2023 09:54
mabhi pushed a commit that referenced this pull request Jul 24, 2023
…in unit tests (#2170)

* add unit tests for repository server controller

* test

* add prerequisites for tests

* add server ready test

* remove unwanted changes

* fix lint issues

* automate creation of repo server CRD

* address review comments

* add symbolic link

* address comments

* remove custom resource

* renaming cli to kubecli

* add more tests

* fix lint issue

* Add tests for Immutability

Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>

* Fix naming conventions

Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>

* Update variables

Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>

* add tests related to secrets

* add secrets configuration for testutils

* add base suite for repository server controller

* use constants for location secret keys

* add unit tests

* make the constants local to the package

* add licence headers

* change package name

* fix build errors

* fix licence headers

* fix lint issues

* remove secret manager changes

* remove unused functions and move to next PR

* add utility functions

* add tests for secrets and cache settings

* fix build issues

* move secret creation utils under test suite

* resolve conflicts

* add base suite for repository server controller

* use constants for location secret keys

* make the constants local to the package

* add licence headers

* fix licence headers

* fix lint issues

* remove unused functions and move to next PR

* fix build issues

* move secret creation utils under test suite

* address review comments

* add tests which got deleted during rebase

* address review comments

* updating tests to use the latest changed values for repository server progress field in status

* move test utilities to pkg/testutil/testutil.go

* rename kopia repository path constant name

* improve tests and comments for better readability

* refactor repository_test.go and secrets_manager_test.go for better readability

* fix tests

* test

* fix tests

* remove unnecessary whitespaces

* rename conflicting env variables with s3compliant prefix

* uncomment tests

* move the env variable related comment at the right place

* check error message for immuatability test

* address comments related to better readability

* change the error message for waitForRepoServerInfoUpdateInCR function

* change the default repositoryserver struct from pointer tto local object

* change waitForRepoServerInfoUpdateInCR function to return error
if podName and serviceName are not set even after the polling time
exceeds

* fix waitForRepoServerInfoUpdateInCR

---------

Signed-off-by: Rajat Gupta <rajat.gupta@veeam.com>
Co-authored-by: Rajat Gupta <37516416+r4rajat@users.noreply.github.com>
Co-authored-by: Rajat Gupta <rajat.gupta@veeam.com>
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

4 participants