Skip to content

[e2e-scan] Test: Strengthen post-sync field assertions in control-plane sync scenario #843

@github-actions

Description

@github-actions

Gap Summary

In test/e2e/scenarios/control-plane/sync/scenario.yaml, step 002-sync-with-delete runs a sync that deletes the original control plane (kongctl-e2e-cp) and creates a new one (kongctl-e2e-cp-2). The post-sync verification step (001-002-verify-post-sync) only asserts two things:

  1. kongctl-e2e-cp is absent from the list (length = 0)
  2. kongctl-e2e-cp-2 exists with name: "kongctl-e2e-cp-2"

The overlay (overlays/002-sync-with-delete/control-plane.yaml) declares kongctl-e2e-cp-2 with:

  • description: "Second Test Control Plane for E2E testing via kongctl"
  • cluster_type: "CLUSTER_TYPE_CONTROL_PLANE"

Neither description nor cluster_type is asserted in the post-sync verification. A regression where sync creates the control plane with the wrong description, a blank description, or an incorrect cluster type would pass the current test undetected.

This is meaningful because:

  • The sync command is the only declarative operation that exercises resource deletion followed by creation in the same transaction
  • Not verifying the fields of the newly created resource means the verification only confirms existence, not correctness
  • The analogous apply scenario (control-plane/apply/scenario.yaml) does verify description and labels after an UPDATE — the sync scenario should meet the same standard

Evidence

Weak post-sync assertion (current):

# test/e2e/scenarios/control-plane/sync/scenario.yaml — step 002-sync-with-delete

- name: 001-002-verify-post-sync
  run: ["get", "konnect", "gateway", "control-planes", "-o", "json"]
  assertions:
    - select: "[?name=='kongctl-e2e-cp']"
      expect:
        fields:
          "length(@)": 0
    - select: "[?name=='kongctl-e2e-cp-2'] | [0]"
      expect:
        fields:
          name: "kongctl-e2e-cp-2"   # ← name only; description and cluster_type not checked

Overlay that declares the fields (but they're not asserted):

  • test/e2e/scenarios/control-plane/sync/overlays/002-sync-with-delete/control-plane.yaml
    • description: "Second Test Control Plane for E2E testing via kongctl"
    • cluster_type: "CLUSTER_TYPE_CONTROL_PLANE"

Reference for stronger assertions:

  • test/e2e/scenarios/control-plane/apply/scenario.yaml step 002-001-verify-fields:
    asserts description, labels.env, and labels.owner after an apply UPDATE

Proposed Scenario Work

Expand the existing scenario test/e2e/scenarios/control-plane/sync/scenario.yaml.

Replace the 001-002-verify-post-sync command's assertions with:

- name: 001-002-verify-post-sync
  run: ["get", "konnect", "gateway", "control-planes", "-o", "json"]
  assertions:
    - select: "[?name=='kongctl-e2e-cp']"
      expect:
        fields:
          "length(@)": 0
    - select: "[?name=='kongctl-e2e-cp-2'] | [0]"
      expect:
        fields:
          name: "kongctl-e2e-cp-2"
          description: "Second Test Control Plane for E2E testing via kongctl"

Alternatively, add a follow-up get konnect gateway control-plane kongctl-e2e-cp-2 -o json command in the same step to verify individual fields with more precise JMESPath selects:

- name: 002-002-verify-created-fields
  run:
    - get
    - konnect
    - gateway
    - control-plane
    - kongctl-e2e-cp-2
    - -o
    - json
  assertions:
    - select: description
      expect:
        fields:
          "@": "Second Test Control Plane for E2E testing via kongctl"
    - select: config.cluster_type
      expect:
        fields:
          "@": "CLUSTER_TYPE_CONTROL_PLANE"

No new testdata files or overlay changes are needed — this is a pure assertion addition.

Acceptance Criteria

  • test/e2e/scenarios/control-plane/sync/scenario.yaml step 002-sync-with-delete includes at least one assertion on the description field of kongctl-e2e-cp-2 after sync
  • Optionally also asserts config.cluster_type on the newly created resource
  • Existing assertions (absence of kongctl-e2e-cp, presence by name of kongctl-e2e-cp-2) are preserved
  • Scenario passes cleanly in the E2E harness

Reference Patterns

  • test/e2e/scenarios/control-plane/apply/scenario.yaml step 002-001-verify-fields — get-by-name with multi-field assertions after an apply mutation
  • test/e2e/scenarios/control-plane/get/scenario.yaml steps 003-get-by-name and 004-get-by-id — individual field selects using description and config.cluster_type

Generated by E2E Coverage Scanner · ● 2.4M ·

  • expires on May 20, 2026, 11:53 PM UTC

Metadata

Metadata

Labels

automatione2eIssue related to the e2e tests and testing frameworkenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions