From 66d369ab52d6399bbb2125750ae0bf3ec4180722 Mon Sep 17 00:00:00 2001 From: Alena Varkockova Date: Tue, 28 Jul 2020 10:55:33 +0200 Subject: [PATCH] Add integration test for apply-delete-apply bug Signed-off-by: Alena Varkockova --- .../apply-delete-apply/00-assert.yaml | 11 +++++ .../apply-delete-apply/00-install.yaml | 8 ++++ .../apply-delete-apply/01-assert.yaml | 6 +++ .../apply-delete-apply/operator/operator.yaml | 42 +++++++++++++++++++ .../apply-delete-apply/operator/params.yaml | 5 +++ .../operator/templates/configmap.yaml | 6 +++ 6 files changed, 78 insertions(+) create mode 100644 test/integration/apply-delete-apply/00-assert.yaml create mode 100644 test/integration/apply-delete-apply/00-install.yaml create mode 100644 test/integration/apply-delete-apply/01-assert.yaml create mode 100644 test/integration/apply-delete-apply/operator/operator.yaml create mode 100644 test/integration/apply-delete-apply/operator/params.yaml create mode 100644 test/integration/apply-delete-apply/operator/templates/configmap.yaml diff --git a/test/integration/apply-delete-apply/00-assert.yaml b/test/integration/apply-delete-apply/00-assert.yaml new file mode 100644 index 000000000..adbb511a1 --- /dev/null +++ b/test/integration/apply-delete-apply/00-assert.yaml @@ -0,0 +1,11 @@ +apiVersion: kudo.dev/v1beta1 +kind: Instance +metadata: + name: configmap-instance +spec: + operatorVersion: + name: configmap-operator-0.1.0 +status: + planStatus: + deploy: + status: COMPLETE \ No newline at end of file diff --git a/test/integration/apply-delete-apply/00-install.yaml b/test/integration/apply-delete-apply/00-install.yaml new file mode 100644 index 000000000..0f702d0cc --- /dev/null +++ b/test/integration/apply-delete-apply/00-install.yaml @@ -0,0 +1,8 @@ +# this is a test covering regression described in #1596 +# there was a race in apply-delete-apply where cache was not invalidated between delete and second apply +# as a result configmap did not exist at the end of plan +apiVersion: kudo.dev/v1beta1 +kind: TestStep +commands: + - command: kubectl kudo install --instance configmap-instance ./operator + namespaced: true diff --git a/test/integration/apply-delete-apply/01-assert.yaml b/test/integration/apply-delete-apply/01-assert.yaml new file mode 100644 index 000000000..6a9899a94 --- /dev/null +++ b/test/integration/apply-delete-apply/01-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: kudo.dev/v1beta1 +kind: ConfigMap +metadata: + name: test-configmap +data: + foo: bar \ No newline at end of file diff --git a/test/integration/apply-delete-apply/operator/operator.yaml b/test/integration/apply-delete-apply/operator/operator.yaml new file mode 100644 index 000000000..45b7f854f --- /dev/null +++ b/test/integration/apply-delete-apply/operator/operator.yaml @@ -0,0 +1,42 @@ +apiVersion: kudo.dev/v1beta1 +name: "configmap-operator" +operatorVersion: "0.1.0" +appVersion: "1.7.9" +kubernetesVersion: 1.13.0 +maintainers: + - name: Your name + email: +url: https://kudo.dev +tasks: + - name: apply + kind: Apply + spec: + resources: + - configmap.yaml + - name: delete + kind: Delete + spec: + resources: + - configmap.yaml +plans: + deploy: + strategy: serial + phases: + - name: main + strategy: serial + steps: + - name: apply + tasks: + - apply + - name: delete + strategy: serial + steps: + - name: delete + tasks: + - delete + - name: apply + strategy: serial + steps: + - name: apply + tasks: + - apply diff --git a/test/integration/apply-delete-apply/operator/params.yaml b/test/integration/apply-delete-apply/operator/params.yaml new file mode 100644 index 000000000..89c6d7726 --- /dev/null +++ b/test/integration/apply-delete-apply/operator/params.yaml @@ -0,0 +1,5 @@ +apiVersion: kudo.dev/v1beta1 +parameters: + - name: replicas + description: Number of replicas that should be run as part of the deployment + default: 2 diff --git a/test/integration/apply-delete-apply/operator/templates/configmap.yaml b/test/integration/apply-delete-apply/operator/templates/configmap.yaml new file mode 100644 index 000000000..cb7772c4a --- /dev/null +++ b/test/integration/apply-delete-apply/operator/templates/configmap.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-configmap +data: + foo: bar \ No newline at end of file