-
Story
-
Resolution: Done
-
Undefined
-
None
-
None
-
8
-
False
-
None
-
False
-
-
-
GitOps Scarlet - Sprint 3261, GitOps Scarlet - Sprint 3263
As part of post-GA work for Rollouts I have been going through the Rollouts operator codebase and looking at whether we have sufficient unit tests written for the most important logic in our code.
In this JIRA item, I have identified a number of unit tests that would be beneficial to add to test the functions in 'controllers/deployment.go'
General guidelines:
- You should not need to create (any new) mocks for these unit tests.
- Consider using 'DescribeTable' in cases where it is possible, in order to avoid duplicating code
Criteria:
- These are the functions in this file I think we need to implement (or improve) the unit tests for:
- generateDesiredRolloutsDeployment: create a unit test for this, including handling the blocks that aren't currently covered, around the `if cr.Spec.AdditionalMetadata != nil {` and `cr.Spec.NodePlacement != nil` blocks
- normalizeDeployment: We have a number of if statements in this function that do validation, that aren't being tested. We can add unit tests to check these. (See coverage report for details)
- rolloutsContainer: try setting an env var of "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", via os.setenv, and ensure that it makes it into the corev1.Container that is returned.
- (This will also indirectly improve the coverage of 'proxyEnvVar', in utils.go)
- getRolloutsContainerImage: the 'if e := os.Getenv(ArgoRolloutsImageEnvName); e != "" && (defaultTag && defaultImg) {` is not currently covered.
- getRolloutsContainerImage: create unit test specifically for this function