Skip to content

Allow tests to assert on status when object is submitted to the cluster #1064

@waciumawanjohi

Description

@waciumawanjohi

There is no simple way to test a single template's healthRules

cartotest makes it easy to assert that a template will stamp an expected object given certain inputs. It allows users to mock out earlier steps in a supply chain. Users also care about the healthRules, status of the created object and the status of the workload. But these can only be evaluated once the given object is submitted to the cluster.

Proposed solution

Create a new cartographer CRD that allows pointing to a template, defining a workload, defining inputs and supplychain params, and asserting on both the status of the object on the cluster and the status of the workload.

Example

apiVersion: carto.run/v1alpha1
kind: CartoTest
metadata:
  name: test-kpack-healthy
spec:
  workload:
    metadata:
      name: my-workload-name
      namespace: my-namespace
    spec:
      serviceAccountName: such-a-good-sa

  templateRef:
    name: image
  inputs:
    sources:
      source:
        url: some-passed-on-url
        revision:
          branch: "some_unused_branch"

  blueprintParams:
    - name: "image_prefix"
      value: "some-prefix"

  assertion:
    lifecycle:
      # either:
      eventually: true
      timeout: "10m"
      # or:
      consistently: true
      duration: "20m"
    expectedObject:
      apiVersion: kpack.io/v1alpha2
      kind: Image
      metadata:
        name: my-workload-name
      status:
      # insert expected status fields here
    expectedWorkloadStatus:
      status:
      # insert expected status fields here

after reconciliation the object would either have a Ready: true or Ready: false condition.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions