Uploaded image for project: 'OpenShift GitOps'
  1. OpenShift GitOps
  2. GITOPS-4780

Rollouts: Improve 'controllers/utils.go' unit tests

XMLWordPrintable

    • 8
    • False
    • None
    • False

      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/utils.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:

      • There are a number of functions that have important logic which we don't have individual unit tests for:
        • Add unit test for 'validateRolloutScope'
        • Add unit test for 'checkForExistingRolloutManager'
        • Add unit test for 'setAdditionalRolloutsLabelsAndAnnotationsToObject' to ensure labels/annotations are set correctly
        • Add unit test for 'envMerge'
        • Add unit test for 'combineImageTag'
        • Add unit test for 'isMergeable'
        • Add unit test for 'insertOrUpdateConditionsInSlice'
        • createCondition: Ensure an error is returned when len(reason) > 1

            Unassigned Unassigned
            jgwest Jonathan West
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: