oncall-engine/helm/oncall/tests/migrate_annotations_test.yaml
Andre Buryndin ab561db8a7
Fixing helm hooks for install stage (#3136)
# What this PR does

## Issue

At the first run (`helm install ...`) the migration job cannot start the
container because cannot find Postgres/Redis/MySQL credentials and
ServiceAccount.

Workaround: set `.migrate.useHook` value to `false` for the `install`
stage, and after you can switch back to `true`.

This PR completely resolves this issue.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated (doesn't
violate anything)
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
- [x] It is manually tested in the internal environment

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2023-11-21 12:21:33 -05:00

52 lines
1.5 KiB
YAML

suite: test migrate annotations
templates:
- engine/job-migrate.yaml
release:
name: oncall
tests:
- it: migrate.useHook=false -> should not provide an annotations block
set:
migrate.useHook: false
asserts:
- notExists:
path: metadata.annotations
- it: migrate.useHook=true -> should provide the "helm.sh/hook" annotations
set:
migrate.useHook: true
asserts:
- equal:
path: metadata.annotations
value:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-1"
- it: migrate.useHook=false and annotations set -> should only contain the custom annotations
set:
migrate.useHook: false
migrate.annotations:
some-annotation: some-value
other-annotation: other-value
asserts:
- equal:
path: metadata.annotations
value:
some-annotation: some-value
other-annotation: other-value
- it: >
migrate.useHook=true and annotations set -> should contain the custom annotations
and the "helm.sh/hook" annotations
set:
migrate.useHook: true
migrate.annotations:
some-annotation: some-value
other-annotation: other-value
asserts:
- equal:
path: metadata.annotations
value:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-1"
some-annotation: some-value
other-annotation: other-value