File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -208,3 +208,46 @@ teardown() {
208208
209209 unstub cache_dummy
210210}
211+
212+ @test " Multiple level saving not forced" {
213+ export BUILDKITE_PLUGIN_CACHE_FORCE=false
214+
215+ export BUILDKITE_PLUGIN_CACHE_SAVE_0=all
216+ export BUILDKITE_PLUGIN_CACHE_SAVE_1=pipeline
217+
218+ stub cache_dummy \
219+ " exists \* \* : exit 0" \
220+ " exists \* \* : exit 1" \
221+ " save \* \* : echo saving \$ 3 in \$ 2"
222+
223+ run " $PWD /hooks/post-command"
224+
225+ assert_success
226+ assert_output --partial ' Saving all-level cache'
227+ refute_output --partial ' Saving pipeline-level cache'
228+
229+ unstub cache_dummy
230+ }
231+
232+ @test " Multiple level saving lower level change forces higher levels" {
233+ export BUILDKITE_PLUGIN_CACHE_FORCE=false
234+
235+ export BUILDKITE_PLUGIN_CACHE_SAVE_0=all
236+ export BUILDKITE_PLUGIN_CACHE_SAVE_1=pipeline
237+ export BUILDKITE_PLUGIN_CACHE_SAVE_2=step
238+
239+ stub cache_dummy \
240+ " exists \* \* : exit 0" \
241+ " exists \* \* : exit 1" \
242+ " save \* \* : echo saving \$ 3 in \$ 2" \
243+ " save \* \* : echo saving \$ 3 in \$ 2"
244+
245+ run " $PWD /hooks/post-command"
246+
247+ assert_success
248+ assert_output --partial ' Saving all-level cache'
249+ assert_output --partial ' Saving pipeline-level cache'
250+ refute_output --partial ' Saving step-level cache'
251+
252+ unstub cache_dummy
253+ }
You can’t perform that action at this time.
0 commit comments