Skip to content

Commit cd2d5f7

Browse files
authored
Purging Cache test for CI (heroku#1713)
When downgrading stacks from `heroku-24` to `heroku-22` we should purge the cache.
1 parent 5065bb9 commit cd2d5f7

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

spec/hatchet/ci_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,31 @@
7474
end
7575
end
7676

77+
it "Purges cache when stack changes" do
78+
Hatchet::Runner.new("ruby_no_rails_test", stack: "heroku-24").tap do |app|
79+
app.before_deploy do
80+
Pathname("app.json").write(<<~EOF)
81+
{ "stack": "heroku-24" }
82+
EOF
83+
end
84+
85+
app.run_ci do |test_run|
86+
expect(test_run.output).to include("Fetching rake")
87+
expect(test_run.output).to_not include("Purging Cache")
88+
89+
# Change stack from heroku-24 to heroku-22
90+
Pathname("app.json").write(<<~EOF)
91+
{ "stack": "heroku-22" }
92+
EOF
93+
run!("git add app.json && git commit -m 'Change stack to heroku-22'")
94+
95+
test_run.run_again
96+
97+
expect(test_run.output).to include("Purging Cache. Changing stack from heroku-24 to heroku-22")
98+
end
99+
end
100+
end
101+
77102
it "CI build time config var behavior" do
78103
script = "echo '## PRINTING ENV ##' && env | sort && echo '## PRINTING ENV DONE ##'; echo '## PRINTING BIN ## ' && ls -1 ./bin | sort && echo '## PRINTING BIN DONE ##'"
79104

0 commit comments

Comments
 (0)