mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 05:17:11 -07:00
feat(ci): Prevent test runs outside of container
It's not safe, we write and delete files all over the place!
This commit is contained in:
parent
a0aa142288
commit
5c886dcd1c
2 changed files with 8 additions and 1 deletions
|
@ -43,6 +43,10 @@ COPY --chown=test:test conf.d $TEST_HOME/.config/fish/conf.d/
|
|||
COPY --chown=test:test functions $TEST_HOME/.config/fish/functions/
|
||||
RUN ls -R $TEST_HOME/.config/fish/
|
||||
|
||||
# Signal we're safely running in a container;
|
||||
# we abort the tests to avoid breaking the host system!
|
||||
ENV RUNNING_IN_CONTAINER=yessir
|
||||
|
||||
# Run tests
|
||||
COPY test ./
|
||||
ENTRYPOINT ["cucumber"]
|
||||
|
|
|
@ -2,6 +2,10 @@ require_relative '../step_definitions/setup'
|
|||
require_relative '../step_definitions/corner_cases.rb'
|
||||
|
||||
BeforeAll do
|
||||
if ENV.fetch('RUNNING_IN_CONTAINER', false) != 'yessir'
|
||||
Kernel.abort("We don't seem to be running in a container; aborting for safety!")
|
||||
end
|
||||
|
||||
run_bash_command('sdk update')
|
||||
end
|
||||
|
||||
|
@ -12,7 +16,6 @@ After do |scenario|
|
|||
_restore_install
|
||||
end
|
||||
|
||||
# Uninstall all SDKMAN! candidates
|
||||
AfterAll do
|
||||
Dir["#{ENV['HOME']}/.sdkman/candidates/*/*"].each do |candidate_dir|
|
||||
_uninstall_candidate_version(candidate_dir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue