Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
waciumawanjohi opened this issue Oct 11, 2022 · 0 comments

Comments

@waciumawanjohi
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant