Skip to content

[test] Write tests for ClusterSummary status to ServiceSet status conversion #2565

Description

@wahabmk

Write tests (whether unit or e2e) targeting servicesStateFromSummary (or any other function responsible for this conversion) which covers some scenarios when converting ClusterSummary status to ServiceSet status.

Especially implement the following flow via mocking unit tests:

  1. Create ServiceSet with A.
  2. ClusterSummary shows A is deployed.
  3. Validate A is deployed in ServiceSet.
  4. ClusterSummary shows A is Failed now (probably need to mock) with failure message.
  5. Validate A in ServiceSet also shows failed with failure message.
  6. ClusterSummary shows A is Pending now with the same failure message from failure previously.
  7. Validate A in ServiceSet is also pending with the failure message.
  8. ClusterSummary shows A has conflict now.
  9. Validate A in ServiceSet shows conflict.
  10. ClusterSummary now shows A is deployed again.
  11. Validate ServiceSet also shows A as deployed.

The following flow in e2e tests is also important IMO:

Changing status of a service:

  1. Create MCS on mothership cluster (can be a CD as well but MCS on mothership is cheap and quick) with service A.
  2. Verify ServiceSet eventually shows A is deployed.
  3. Induce forced failure in A. E.g with following:
      - template: ingress-nginx-4-13-0
        name: nginx
        namespace: nginx
        helmOptions:
          timeout: 1s
        values: |
          ingress-nginx:
            global:
              image:
                registry: this.does.not.exist.com
      - template: postgres-operator-1-15-1
  1. Verify the ClusterSummary shows error.
  2. Verify the ServiceSet also shows error with the same failure message as reported in the ClusterSummary.
  3. Now remove the invalid config from MCS for A so it can become deployed again.
  4. Verify ServiceSet eventually shows A is deployed again.

Status of service with conflict:

  1. Create MCS1 on mothership cluster with priority 100 with service A1.
  2. Create MCS2 on mothership cluster with priority 200 with service A2.
    (Here A1 and A2 refer to the same service A but A2 just means a newer version of A than A1)
  3. Verify that ClusterSummary for MCS2 shows A deployed.
  4. Verify that the ServiceSet for MCS2 also reflects that A is deployed.
  5. Verify that ClusterSummary for MCS1 shows conflict with failure message (because MCS1 is lower priority).
  6. Verify that the conflict status along with any failure message and other relevant info is reflected in the ServiceSet for MCS1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ksmIssue relates to ksm (K0rdent State Mgmt)testsIssue relates to the unit & e2e tests (bugs / enhancements)triage-okTriaged issue, can be taken into work

Type

Projects

  • Status
    On Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions