diff --git a/tests/olm/1-005_drop_resource_customizations/01-alpha-argocd.yaml b/tests/olm/1-005_drop_resource_customizations/01-alpha-argocd.yaml new file mode 100644 index 000000000..7d341ce2a --- /dev/null +++ b/tests/olm/1-005_drop_resource_customizations/01-alpha-argocd.yaml @@ -0,0 +1,50 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ArgoCD +metadata: + name: argocd +spec: + resourceCustomizations: | + PersistentVolumeClaim: + health.lua: | + hs = {} + if obj.status ~= nil then + if obj.status.phase ~= nil then + if obj.status.phase == "Pending" then + hs.status = "Healthy" + hs.message = obj.status.phase + return hs + end + if obj.status.phase == "Bound" then + hs.status = "Healthy" + hs.message = obj.status.phase + return hs + end + end + end + hs.status = "Progressing" + hs.message = "Waiting for certificate" + return hs + resourceHealthChecks: + - group: certmanager.k8s.io + kind: Certificate + check: | + hs = {} + if obj.status ~= nil then + if obj.status.conditions ~= nil then + for i, condition in ipairs(obj.status.conditions) do + if condition.type == "Ready" and condition.status == "False" then + hs.status = "Degraded" + hs.message = condition.message + return hs + end + if condition.type == "Ready" and condition.status == "True" then + hs.status = "Healthy" + hs.message = condition.message + return hs + end + end + end + end + hs.status = "Progressing" + hs.message = "Waiting for certificate" + return hs \ No newline at end of file diff --git a/tests/olm/1-005_drop_resource_customizations/01-assert.yaml b/tests/olm/1-005_drop_resource_customizations/01-assert.yaml new file mode 100644 index 000000000..442d5159a --- /dev/null +++ b/tests/olm/1-005_drop_resource_customizations/01-assert.yaml @@ -0,0 +1,32 @@ +apiVersion: argoproj.io/v1beta1 +kind: ArgoCD +metadata: + name: argocd +spec: + resourceHealthChecks: + - group: certmanager.k8s.io + kind: Certificate + check: | + hs = {} + if obj.status ~= nil then + if obj.status.conditions ~= nil then + for i, condition in ipairs(obj.status.conditions) do + if condition.type == "Ready" and condition.status == "False" then + hs.status = "Degraded" + hs.message = condition.message + return hs + end + if condition.type == "Ready" and condition.status == "True" then + hs.status = "Healthy" + hs.message = condition.message + return hs + end + end + end + end + hs.status = "Progressing" + hs.message = "Waiting for certificate" + return hs +status: + phase: Available + diff --git a/tests/olm/1-005_drop_resource_customizations/02-errors.yaml b/tests/olm/1-005_drop_resource_customizations/02-errors.yaml new file mode 100644 index 000000000..e923cd849 --- /dev/null +++ b/tests/olm/1-005_drop_resource_customizations/02-errors.yaml @@ -0,0 +1,27 @@ +apiVersion: argoproj.io/v1beta1 +kind: ArgoCD +metadata: + name: argocd +spec: + resourceCustomizations: | + PersistentVolumeClaim: + health.lua: | + hs = {} + if obj.status ~= nil then + if obj.status.phase ~= nil then + if obj.status.phase == "Pending" then + hs.status = "Healthy" + hs.message = obj.status.phase + return hs + end + if obj.status.phase == "Bound" then + hs.status = "Healthy" + hs.message = obj.status.phase + return hs + end + end + end + hs.status = "Progressing" + hs.message = "Waiting for certificate" + return hs +