Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chart/templates/jobs/create-user-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ metadata:
{{- $annotations := dict }}
{{- if .Values.createUserJob.useHelmHooks }}
{{- $_ := set $annotations "helm.sh/hook" "post-install,post-upgrade" }}
{{- $_ := set $annotations "helm.sh/hook-weight" "1" }}
{{- $_ := set $annotations "helm.sh/hook-weight" "2" }}
{{- $_ := set $annotations "helm.sh/hook-delete-policy" "before-hook-creation,hook-succeeded" }}
{{- end }}
{{- with $annotations := merge $annotations .Values.createUserJob.jobAnnotations }}
Expand Down
7 changes: 7 additions & 0 deletions chart/tests/test_airflow_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,10 @@ def test_should_use_correct_image(self, use_default_image, expected_image):

for doc in docs:
assert expected_image == jmespath.search("spec.template.spec.initContainers[0].image", doc)

def test_should_set_correct_helm_hooks_weight(self):
docs = render_chart(
show_only=["templates/secrets/fernetkey-secret.yaml"],
)
annotations = jmespath.search("metadata.annotations", docs[0])
assert annotations["helm.sh/hook-weight"] == "0"
9 changes: 9 additions & 0 deletions chart/tests/test_create_user_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,12 @@ def test_should_disable_default_helm_hooks(self):
)
annotations = jmespath.search("spec.template.metadata.annotations", docs[0])
assert annotations is None

def test_should_set_correct_helm_hooks_weight(self):
docs = render_chart(
show_only=[
"templates/jobs/create-user-job.yaml",
],
)
annotations = jmespath.search("metadata.annotations", docs[0])
assert annotations["helm.sh/hook-weight"] == "2"
11 changes: 10 additions & 1 deletion chart/tests/test_migrate_database_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,14 @@ def test_should_disable_default_helm_hooks(self):
values={"migrateDatabaseJob": {"useHelmHooks": False}},
show_only=["templates/jobs/migrate-database-job.yaml"],
)
annotations = jmespath.search("spec.template.metadata.annotations", docs[0])
annotations = jmespath.search("metadata.annotations", docs[0])
assert annotations is None

def test_should_set_correct_helm_hooks_weight(self):
docs = render_chart(
show_only=[
"templates/jobs/migrate-database-job.yaml",
],
)
annotations = jmespath.search("metadata.annotations", docs[0])
assert annotations["helm.sh/hook-weight"] == "1"
10 changes: 10 additions & 0 deletions chart/tests/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,13 @@ def test_redis_resources_are_not_added_by_default(self):
show_only=["templates/redis/redis-statefulset.yaml"],
)
assert jmespath.search("spec.template.spec.containers[0].resources", docs[0]) == {}

def test_should_set_correct_helm_hooks_weight(self):
docs = render_chart(
values={
"executor": "CeleryExecutor",
},
show_only=["templates/secrets/redis-secrets.yaml"],
)
annotations = jmespath.search("metadata.annotations", docs[0])
assert annotations["helm.sh/hook-weight"] == "0"