Allow to pass parameters to Cucumber in Docker.

Also add some comments.
This commit is contained in:
Raphael Reitzig 2020-05-26 16:35:31 +02:00
parent 2afb22f6af
commit 15997dcba8
3 changed files with 40 additions and 6 deletions

View file

@ -2,13 +2,13 @@
[![Build Status][travis-badge]][travis-link]
Makes command `sdk` from [SDKMAN!] usable from fish, including auto-completion.
Makes command `sdk` from [SDKMAN!] usable from [fish], including auto-completion.
Also adds binaries from installed SDKs to the PATH.
Version 1.4.0 tested with
Version 1.5.0 tested with
- fish 2.7.1 and 3.0.2, and
- SDKMAN! 5.7.4, on
- fish 2.7.1 and 3.1.2, and
- SDKMAN! 5.8.2, on
- Ubuntu 18.04 LTS and macOS 10.13
## Install
@ -38,13 +38,29 @@ As the tests may mess up your own setup
-- you have been warned! --
the recommended way is to run the tests in a Docker container:
```bash
```fish
docker build -t sdkman-for-fish-tests -f test/Dockerfile .
docker run --rm sdkman-for-fish-tests
```
A run configuration for Jetbrains IDEs is included.
It is a also possible to run individual features, for instance:
```fish
docker run --rm sdkman-for-fish-tests features/completions.feature
```
As a corollary, this is the fastest way to run all tests
(if you do not care about the report):
```fish
for f in features/*.feature
docker run --rm sdkman-for-fish-tests "$f" &
done
wait
```
## Acknowledgements
* Completion originally by [Ted Wise](https://github.com/ctwise); see his
@ -53,6 +69,7 @@ A run configuration for Jetbrains IDEs is included.
see [his comment on sdkman/sdkman-cli#294](https://github.com/sdkman/sdkman-cli/issues/294#issuecomment-318252058).
[SDKMAN!]: https://github.com/sdkman/sdkman-cli
[fish]: https://fishshell.com/
[fisher]: https://github.com/jorgebucaran/fisher
[travis-link]: https://travis-ci.org/reitzig/sdkman-for-fish
[travis-badge]: https://travis-ci.org/reitzig/sdkman-for-fish.svg?branch=master

View file

@ -21,6 +21,13 @@ RUN groupadd -r test \
USER test
RUN curl -s "https://get.sdkman.io" | bash
# To speed up tests, uncomment this shared setup:
#SHELL ["/bin/bash", "-c"]
#RUN source "$TEST_HOME/.sdkman/bin/sdkman-init.sh" \
# && sdk install ant 1.9.9 \
# && sdk install ant 1.10.1 \
# && sdk install crash
# "Install" sdkman-for-fish
RUN mkdir -p $TEST_HOME/.config/fish/
COPY --chown=test:test completions $TEST_HOME/.config/fish/completions/
@ -30,4 +37,5 @@ RUN ls -R $TEST_HOME/.config/fish/
# Run tests
COPY test ./
CMD cucumber
ENTRYPOINT ["cucumber"]
CMD []

View file

@ -7,6 +7,15 @@ Given(/^SDKMAN! candidate list is up to date$/) do
end
Given(/^candidate (\w+) is installed at version (\d+(?:\.\d+)*)$/) do |candidate, version|
# TODO: Can we mock-install instead?
# Something like
#
# mkdir -p ${SDKMAN_CANDIDATES_DIR}/${candidate}/{version}/bin \
# && touch ${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}/bin/${candidate} &&
# ln -s ${SDKMAN_CANDIDATES_DIR}/${candidate}/current ${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}
#
# should be quite enough to trick sdk as far as we need it to trick.
# Or is it?
run_bash_command("sdk install #{candidate} #{version}") unless installed?(candidate, version)
end