-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is a separate Docker worker that allows running Bats tests based on version 1.2.0 of `bats-core` project. This modification allows receiving updates to the test runner. All testing procedure is reworked in a way that `workflows` file is responsible for running Docker workers for testing while scripts, located at `.workflows` directory, just run the needed workflows without pointing to an environment. `tests/git-elegant.bats` was updated as in Bash 3.x (which is used in the Bats worker) is not possible to get the last element of the array. So, `show-commands` in the tests is replaced with `prune-repository` as the last command produces the same amount of lines comparing to the fact that adding or removing of command will affect the output of `show-commands`. #135
- Loading branch information
Showing
9 changed files
with
216 additions
and
140 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG bashversion=3.2.57 | ||
FROM bash:${bashversion} | ||
LABEL maintainer="Dmytro Serdiuk <[email protected]>" \ | ||
description="The image serves the environment for the testing of Elegant Git." | ||
VOLUME /elegant-git | ||
WORKDIR /elegant-git | ||
ENV EG_ENABLE_TESTING true | ||
ARG gitversion=2.26.2 | ||
RUN apk add --no-cache git~=${gitversion} | ||
ARG batsversion=v1.2.0 | ||
RUN git clone --branch ${batsversion} --single-branch --depth 1 https://github.com/bats-core/bats-core.git; \ | ||
cd bats-core && ./install.sh /usr/local && cd - && rm -r bats-core | ||
COPY bats-workflows.bash /bats-workflows.bash | ||
ENTRYPOINT [ "/bats-workflows.bash" ] | ||
CMD ["help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
# Runs bats tests | ||
# usage: ./script [command name] | ||
if [[ -f version ]]; then | ||
rm -v version | ||
fi | ||
|
||
all_tests() { | ||
exec bats --tap --recursive tests | ||
} | ||
|
||
some_tests() { | ||
exec bats --tap $(find tests -type f -name "*${1}*") | ||
} | ||
|
||
usage() { | ||
cat <<MESSAGE | ||
usage: ${BASH_SOURCE[0]} <command> | ||
Available commands: | ||
help prints this message | ||
all_tests runs all Bats tests | ||
some_tests runs Bats tests matchinh a pattern | ||
MESSAGE | ||
} | ||
|
||
main() { | ||
case ${1} in | ||
all_tests) all_tests ;; | ||
some_tests) shift; some_tests "${@}" ;; | ||
help) usage ;; | ||
*) "${@}" ;; | ||
esac | ||
} | ||
|
||
main "${@}" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
# This script is destructive! That's why it will work only if a specific variable is set. | ||
# It's recommended to run it within a docker container only. | ||
# Usage: | ||
# ./installation-workflows.bash runs quality pipeline | ||
# ./installation-workflows.bash prints tooling version | ||
set -e | ||
|
||
install() { | ||
echo "Installation...." | ||
git config --global user.name "Elegant Git" | ||
git config --global user.email [email protected] | ||
git config --global core.editor vi | ||
git config --global elegant-git.acquired true | ||
./install.bash /usr/local src | ||
} | ||
|
||
smoke-tests() { | ||
echo "'Unknown command' testing..." | ||
git elegant unknown-command | grep "Unknown command: git elegant unknown-command" | ||
echo "Check installation of version's file..." | ||
git elegant --version || exit 1 | ||
} | ||
|
||
check-env() { | ||
if [[ -z ${EG_ENABLE_TESTING} ]]; then | ||
echo "Testing is disabled! Looks like the environment is not ready..." | ||
exit 1 | ||
fi | ||
} | ||
|
||
usage() { | ||
cat <<MESSAGE | ||
usage: ${BASH_SOURCE[0]} <command> | ||
Available commands: | ||
help prints this message | ||
install runs the installation process | ||
smoke-tests runs smoke tests of the installation | ||
MESSAGE | ||
} | ||
|
||
main() { | ||
case $1 in | ||
install) check-env && install ;; | ||
smoke-tests) check-env && smoke-tests ;; | ||
help) usage ;; | ||
*) echo "Available commands: --version or testing"; exit 1 ;; | ||
esac | ||
} | ||
|
||
main "$@" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.