kuttl icon indicating copy to clipboard operation
kuttl copied to clipboard

Document Assert with Label Selector

Open kensipe opened this issue 5 years ago • 3 comments

Test the following and work fine:

00-install.yaml

apiVersion: v1
kind: Pod
metadata:
  name: static-web
  labels:
    environment: production
    app: nginx
spec:
  containers:
    - name: web
      image: nginx

00-assert.yaml

apiVersion: v1
kind: Pod
metadata:
  labels:
    environment: production
status:
  phase: Running

Assert does NOT have name... working strictly off labels. Needs to be documented

kensipe avatar May 26 '20 19:05 kensipe

Even the assert is good on mismatch... for example change the assert file label from production to pro shows the following error:

        
    kuttl/harness/pod: case.go:156: resource Pod:kudo-test-humble-crab/: .metadata.labels.environment: value mismatch, expected: pro != actual: production

kensipe avatar May 26 '20 19:05 kensipe

similar to #158

kensipe avatar Jul 17 '20 19:07 kensipe

As explained in https://github.com/kudobuilder/kuttl/issues/480#issuecomment-1747746365 this label selector does not really work right now. The example above only happens to work by coincidence in the "signgleton" case - where no other resources of given kind exist. However once #488 is merged it will work more generally as described above, and this should be documented, so this ticket still makes sense.

porridge avatar Oct 05 '23 06:10 porridge