Skip to content

Commit 5524a41

Browse files
mattia-eleuterimyasnikovdaniil
authored andcommitted
test(redis): pin the release name in the Sentinel PDB hook for the longest release
The long-name case checked only that the Job name fits in 63 characters and that the Job targets the right PDB. A Job name that dropped the release, letting two releases' hooks replace each other, or a Role granting a different PDB would both have passed. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <[email protected]> (cherry picked from commit 9fba8af) Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 3245516 commit 5524a41

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎packages/apps/redis/tests/sentinel_pdb_hook_test.yaml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,30 @@ tests:
116116
- matchRegex:
117117
path: metadata.name
118118
pattern: '[a-z0-9]$'
119+
# The full release name stays in the Job name, so the hooks of two
120+
# releases in one namespace never replace each other's Job.
121+
- matchRegex:
122+
path: metadata.name
123+
pattern: ^redis-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-
119124
- equal:
120125
path: spec.template.spec.containers[0].command[4]
121126
value: rfs-redis-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
122127

128+
- it: lets the hook delete the Sentinel PDB of the longest release name
129+
release:
130+
name: redis-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
131+
upgrade: true
132+
set:
133+
replicas: 1
134+
documentSelector:
135+
path: kind
136+
value: Role
137+
asserts:
138+
- equal:
139+
path: rules[0].resourceNames
140+
value:
141+
- rfs-redis-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
142+
123143
- it: keeps the full Job name for a short release name
124144
release:
125145
upgrade: true

0 commit comments

Comments
 (0)