@@ -105,6 +105,7 @@ remote_rows() {
105105 echo " FAIL: render_script reported success with no chart"
106106 false
107107 fi
108+ rm -rf " $tmp "
108109}
109110
110111@test " restore reads back the archive the Backup recorded, not the newest one" {
@@ -116,6 +117,7 @@ remote_rows() {
116117 PATH=" $tmp /bin:$PATH " bash " $tmp /s.sh"
117118 grep -qxF ' POST http://chi-clickhouse-myapp-clickhouse-0-0.tenant-x.svc:7171/backup/restore_remote/clickhouse-myapp-20260304T050607Z' " $tmp /curl.log"
118119 [ " $( grep -c ' /backup/restore_remote/' " $tmp /curl.log" ) " -eq 1 ]
120+ rm -rf " $tmp "
119121}
120122
121123@test " restore fails naming the recorded archive when remote storage lacks it" {
@@ -133,6 +135,7 @@ remote_rows() {
133135 echo " FAIL: restored another archive: $( cat " $tmp /curl.log" ) "
134136 false
135137 fi
138+ rm -rf " $tmp "
136139}
137140
138141@test " restore of a Backup without a recorded archive takes the newest one stamped by its takenAt, and warns" {
@@ -150,6 +153,7 @@ remote_rows() {
150153 grep -qxF ' POST http://chi-clickhouse-myapp-clickhouse-0-0.tenant-x.svc:7171/backup/restore_remote/clickhouse-myapp-20260304T050607Z' " $tmp /curl.log"
151154 [ " $( grep -c ' /backup/restore_remote/' " $tmp /curl.log" ) " -eq 1 ]
152155 printf ' %s\n' " $out " | grep -qF ' WARNING: Backup bkp-a records no archive name'
156+ rm -rf " $tmp "
153157}
154158
155159@test " restore of a Backup without a recorded archive fails when no archive is stamped by its takenAt" {
@@ -167,6 +171,7 @@ remote_rows() {
167171 echo " FAIL: restored an archive newer than takenAt: $( cat " $tmp /curl.log" ) "
168172 false
169173 fi
174+ rm -rf " $tmp "
170175}
171176
172177@test " backup writes the archive under the name the controller chose" {
@@ -175,6 +180,7 @@ remote_rows() {
175180 render_script " $tmp /s.sh" backup myapp clickhouse-myapp-20260304T050607Z " " " "
176181 PATH=" $tmp /bin:$PATH " bash " $tmp /s.sh"
177182 grep -qxF ' POST http://chi-clickhouse-myapp-clickhouse-0-0.tenant-x.svc:7171/backup/create_remote?name=clickhouse-myapp-20260304T050607Z&resume=true' " $tmp /curl.log"
183+ rm -rf " $tmp "
178184}
179185
180186@test " a retried backup waits on the attempt the sidecar is still running" {
@@ -189,6 +195,7 @@ remote_rows() {
189195 echo " FAIL: started another operation over the running one: $( cat " $tmp /curl.log" ) "
190196 false
191197 fi
198+ rm -rf " $tmp "
192199}
193200
194201@test " a retried backup after a failed attempt resumes the same archive" {
@@ -198,6 +205,7 @@ remote_rows() {
198205 printf ' {"command":"create_remote clickhouse-myapp-20260304T050607Z","status":"error","start":"2026-03-04 05:06:08","error":"S3 PutObject 403"}\n' > " $tmp /actions"
199206 PATH=" $tmp /bin:$PATH " bash " $tmp /s.sh"
200207 grep -qxF ' POST http://chi-clickhouse-myapp-clickhouse-0-0.tenant-x.svc:7171/backup/create_remote?name=clickhouse-myapp-20260304T050607Z&resume=true' " $tmp /curl.log"
208+ rm -rf " $tmp "
201209}
202210
203211@test " backup falls back to a timestamped name when the controller supplies none" {
@@ -206,4 +214,5 @@ remote_rows() {
206214 render_script " $tmp /s.sh" backup myapp " " " " " "
207215 PATH=" $tmp /bin:$PATH " bash " $tmp /s.sh"
208216 grep -qE ' ^POST http://[^ ]*/backup/create_remote\?name=clickhouse-myapp-[0-9]{8}T[0-9]{6}Z&resume=true$' " $tmp /curl.log"
217+ rm -rf " $tmp "
209218}
0 commit comments