diff --git a/tests/k8s/1-033_validate_label_selector/01-add-label-selector.yaml b/tests/k8s/1-033_validate_label_selector/01-add-label-selector.yaml new file mode 100644 index 000000000..a1c515bc6 --- /dev/null +++ b/tests/k8s/1-033_validate_label_selector/01-add-label-selector.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: +# patches the subscription to add label selector in argocd-operator +- script: | + kubectl patch -n $NAMESPACE argocd/argocd --type='json' -p='[{"op": "remove", "path": "/spec/sso"}]' +- script: sleep 10 diff --git a/tests/k8s/1-033_validate_label_selector/02-assert.yaml b/tests/k8s/1-033_validate_label_selector/02-assert.yaml deleted file mode 100644 index 79faab32d..000000000 --- a/tests/k8s/1-033_validate_label_selector/02-assert.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: test1-redis ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: test1-repo-server ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: test1-server ---- -apiVersion: v1 -kind: Service -metadata: - name: test1-metrics ---- -apiVersion: v1 -kind: Service -metadata: - name: test1-redis ---- -apiVersion: v1 -kind: Service -metadata: - name: test1-repo-server ---- -apiVersion: v1 -kind: Service -metadata: - name: test1-server ---- -apiVersion: v1 -kind: Service -metadata: - name: test1-server-metrics \ No newline at end of file diff --git a/tests/k8s/1-033_validate_label_selector/01-errors.yaml b/tests/k8s/1-033_validate_label_selector/02-errors.yaml similarity index 78% rename from tests/k8s/1-033_validate_label_selector/01-errors.yaml rename to tests/k8s/1-033_validate_label_selector/02-errors.yaml index 369ddad0d..788725822 100644 --- a/tests/k8s/1-033_validate_label_selector/01-errors.yaml +++ b/tests/k8s/1-033_validate_label_selector/02-errors.yaml @@ -1,6 +1,6 @@ apiVersion: argoproj.io/v1alpha1 kind: ArgoCD metadata: - name: example-argocd + name: test1 status: phase: Available \ No newline at end of file diff --git a/tests/k8s/1-033_validate_label_selector/01-install.yaml b/tests/k8s/1-033_validate_label_selector/02-install.yaml similarity index 100% rename from tests/k8s/1-033_validate_label_selector/01-install.yaml rename to tests/k8s/1-033_validate_label_selector/02-install.yaml diff --git a/tests/k8s/1-033_validate_label_selector/02-add-label-selector.yaml b/tests/k8s/1-033_validate_label_selector/03-add-label.yaml similarity index 72% rename from tests/k8s/1-033_validate_label_selector/02-add-label-selector.yaml rename to tests/k8s/1-033_validate_label_selector/03-add-label.yaml index ab369360c..6f60b82d3 100644 --- a/tests/k8s/1-033_validate_label_selector/02-add-label-selector.yaml +++ b/tests/k8s/1-033_validate_label_selector/03-add-label.yaml @@ -3,5 +3,5 @@ kind: TestStep commands: # patches the argocd instance with the label-selector - script: | - kubectl label argocd test1 foo=bar -n test-argocd + kubectl label argocd test1 foo=bar -n $NAMESPACE - script: sleep 60 \ No newline at end of file diff --git a/tests/k8s/1-033_validate_label_selector/03-assert.yaml b/tests/k8s/1-033_validate_label_selector/03-assert.yaml index a30506793..79faab32d 100644 --- a/tests/k8s/1-033_validate_label_selector/03-assert.yaml +++ b/tests/k8s/1-033_validate_label_selector/03-assert.yaml @@ -1,31 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test1-redis +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test1-repo-server +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test1-server +--- +apiVersion: v1 +kind: Service +metadata: + name: test1-metrics +--- +apiVersion: v1 +kind: Service +metadata: + name: test1-redis +--- +apiVersion: v1 +kind: Service +metadata: + name: test1-repo-server +--- apiVersion: v1 -data: - policy.csv: "" - policy.default: role:readonly - scopes: '[email]' -kind: ConfigMap -metadata: - labels: - app.kubernetes.io/managed-by: test1 - app.kubernetes.io/name: argocd-rbac-cm - app.kubernetes.io/part-of: argocd - name: argocd-rbac-cm - namespace: test-argocd - - - - -# apiVersion: argoproj.io/v1alpha1 -# kind: ArgoCD -# metadata: -# name: test1 -# namespace: test-argocd -# labels: -# example: basic -# spec: -# rbac: -# policy: | -# g, system:cluster-admins, role:admin -# g, cluster-admins, role:admin -# scopes: '[email]' - +kind: Service +metadata: + name: test1-server +--- +apiVersion: v1 +kind: Service +metadata: + name: test1-server-metrics \ No newline at end of file diff --git a/tests/k8s/1-033_validate_label_selector/04-assert.yaml b/tests/k8s/1-033_validate_label_selector/04-assert.yaml new file mode 100644 index 000000000..a30506793 --- /dev/null +++ b/tests/k8s/1-033_validate_label_selector/04-assert.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +data: + policy.csv: "" + policy.default: role:readonly + scopes: '[email]' +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/managed-by: test1 + app.kubernetes.io/name: argocd-rbac-cm + app.kubernetes.io/part-of: argocd + name: argocd-rbac-cm + namespace: test-argocd + + + + +# apiVersion: argoproj.io/v1alpha1 +# kind: ArgoCD +# metadata: +# name: test1 +# namespace: test-argocd +# labels: +# example: basic +# spec: +# rbac: +# policy: | +# g, system:cluster-admins, role:admin +# g, cluster-admins, role:admin +# scopes: '[email]' + diff --git a/tests/k8s/1-033_validate_label_selector/03-install.yaml b/tests/k8s/1-033_validate_label_selector/04-install.yaml similarity index 100% rename from tests/k8s/1-033_validate_label_selector/03-install.yaml rename to tests/k8s/1-033_validate_label_selector/04-install.yaml diff --git a/tests/k8s/1-033_validate_label_selector/04-remove-label-selector.yaml b/tests/k8s/1-033_validate_label_selector/05-remove-label.yaml similarity index 100% rename from tests/k8s/1-033_validate_label_selector/04-remove-label-selector.yaml rename to tests/k8s/1-033_validate_label_selector/05-remove-label.yaml diff --git a/tests/k8s/1-033_validate_label_selector/06-assert.yaml b/tests/k8s/1-033_validate_label_selector/06-assert.yaml new file mode 100644 index 000000000..a30506793 --- /dev/null +++ b/tests/k8s/1-033_validate_label_selector/06-assert.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +data: + policy.csv: "" + policy.default: role:readonly + scopes: '[email]' +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/managed-by: test1 + app.kubernetes.io/name: argocd-rbac-cm + app.kubernetes.io/part-of: argocd + name: argocd-rbac-cm + namespace: test-argocd + + + + +# apiVersion: argoproj.io/v1alpha1 +# kind: ArgoCD +# metadata: +# name: test1 +# namespace: test-argocd +# labels: +# example: basic +# spec: +# rbac: +# policy: | +# g, system:cluster-admins, role:admin +# g, cluster-admins, role:admin +# scopes: '[email]' + diff --git a/tests/k8s/1-033_validate_label_selector/05-errors.yaml b/tests/k8s/1-033_validate_label_selector/06-errors.yaml similarity index 100% rename from tests/k8s/1-033_validate_label_selector/05-errors.yaml rename to tests/k8s/1-033_validate_label_selector/06-errors.yaml diff --git a/tests/k8s/1-033_validate_label_selector/05-install.yaml b/tests/k8s/1-033_validate_label_selector/06-install.yaml similarity index 100% rename from tests/k8s/1-033_validate_label_selector/05-install.yaml rename to tests/k8s/1-033_validate_label_selector/06-install.yaml diff --git a/tests/k8s/1-033_validate_label_selector/07-remove-label-selector.yaml b/tests/k8s/1-033_validate_label_selector/07-remove-label-selector.yaml new file mode 100644 index 000000000..a1c515bc6 --- /dev/null +++ b/tests/k8s/1-033_validate_label_selector/07-remove-label-selector.yaml @@ -0,0 +1,7 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: +# patches the subscription to add label selector in argocd-operator +- script: | + kubectl patch -n $NAMESPACE argocd/argocd --type='json' -p='[{"op": "remove", "path": "/spec/sso"}]' +- script: sleep 10