gdt-dev / gdt

Go Declarative Testing
Apache License 2.0
4 stars 2 forks source link

Support custom retry intervals and attempts #26

Closed jaypipes closed 3 months ago

jaypipes commented 3 months ago

For some plugins like gdt-kube, we retry actions if we fail assertions.

We should add the ability to control the retry behaviour. The interval and number of attempts is plugin-specific but we should allow a GDT top-level retry field and defaults that overrides retry interval and number of attempts.

Something like this might work:

name: matches
description: create a deployment and check the matches condition succeeds
fixtures:
  - kind
defaults:
  retry:
    attempts: 10
    interval: 30s
tests:
  - name: create-deployment
    kube:
      create: testdata/manifests/nginx-deployment.yaml
  - name: deployment-exists
    kube:
      get: deployments/nginx:
    retry:
      attempts: 2
    assert:
      matches:
        spec:
          replicas: 2
          template:
            metadata:
              labels:
                app: nginx
        status:
          readyReplicas: 2
  - name: delete-deployment
    kube:
      delete: deployments/nginx