forked from eclipse-che/che
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·58 lines (52 loc) · 2.32 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·58 lines (52 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# Copyright (c) 2012-2017 Red Hat, Inc
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Marian Labuda - Initial Implementation
set -e
BATS_BASE_DIR=$(cd "$(dirname "$0")"/..; pwd)
. "${BATS_BASE_DIR}"/build.include
BATS_BASE_DIR=$(get_mount_path "${BATS_BASE_DIR}")
init --name:bats "$@"
DOCKER_RUN_OPTIONS=""
BATS_OPTIONS=""
# run bats with terminal mode (pretty print) if supported by current shell
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-t"
BATS_OPTIONS="--pretty"
else
BATS_OPTIONS="--tap"
fi
# Runs functional CLI tests in a docker container.
# Pass a file name of functional bats tests as an argument.
# The file has to be placed in tests folder in directory containing this script
# (Optional) second argument is options for a docker run command.
run_test_in_docker_container() {
docker_exec run --rm ${DOCKER_RUN_OPTIONS} $2 \
-v "${BATS_BASE_DIR}":/dockerfiles \
-e CLI_IMAGE="$ORGANIZATION/$PREFIX-cli:$TAG" \
-e BATS_BASE_DIR="${BATS_BASE_DIR}" \
-v /var/run/docker.sock:/var/run/docker.sock \
$IMAGE_NAME bats ${BATS_OPTIONS} /dockerfiles/cli/tests/$1
}
echo "Running tests in container from image $IMAGE_NAME"
echo "Running functionals bats tests for overriding images"
run_test_in_docker_container override_image_tests.bats ""
echo "Running functional bats tests for CLI prompts and usage"
run_test_in_docker_container cli_prompts_usage_tests.bats ""
echo "Running functionals bats tests for config command"
run_test_in_docker_container cmd_config_tests.bats ""
echo "Running functionals bats tests for info command"
run_test_in_docker_container cmd_info_tests.bats ""
echo "Running functional bats tests for init and destroy commands"
run_test_in_docker_container cmd_init_destroy_tests.bats ""
echo "Running functionals bats tests for start, stop, restart command"
run_test_in_docker_container cmd_start_stop_restart_tests.bats --net=host
echo "Running functionals bats tests for backup / restore commands"
run_test_in_docker_container cmd_backup_restore_tests.bats ""
echo "Running functionals bats tests for offline command"
run_test_in_docker_container cmd_offline_tests.bats ""