Skip to content
Permalink
Browse files

locate configuration file before we run the tests #410

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
  • Loading branch information
konstruktoid committed Dec 17, 2019
1 parent 19173cb commit 269b71eed81366c53f0bfd8087224c5776bc4cc1
Showing with 11 additions and 3 deletions.
  1. +3 −0 docker-bench-security.sh
  2. +7 −2 helper_lib.sh
  3. +1 −1 tests/2_docker_daemon_configuration.sh
@@ -93,6 +93,9 @@ beginjson "$version" "$(date +%s)"

# Load all the tests from tests/ and run them
main () {
# Get configuration location
get_docker_configuration_file

# If there is a container with label docker_bench_security, memorize it:
benchcont="nil"
for c in $(docker ps | sed '1d' | awk '{print $NF}'); do
@@ -82,8 +82,7 @@ get_docker_effective_command_line_args() {
get_docker_cumulative_command_line_args "$OPTION" | tail -n1
}

get_docker_configuration_file_args() {
OPTION="$1"
get_docker_configuration_file() {
FILE="$(get_docker_effective_command_line_args '--config-file' | \
sed 's/.*=//g')"

@@ -94,6 +93,12 @@ get_docker_configuration_file_args() {
else
CONFIG_FILE='/dev/null'
fi
}

get_docker_configuration_file_args() {
OPTION="$1"

get_docker_configuration_file

grep "$OPTION" "$CONFIG_FILE" | sed 's/.*://g' | tr -d '" ',
}
@@ -150,7 +150,7 @@ check_2_6() {
starttestjson "$id_2_6" "$desc_2_6"

totalChecks=$((totalChecks + 1))
if grep -qi 'tcp://' "$CONFIG_FILE" || \
if [ $(get_docker_configuration_file_args 'tcp://') ] || \
[ $(get_docker_cumulative_command_line_args '-H' | grep -vE '(unix|fd)://') >/dev/null 2>&1 ]; then
if [ $(get_docker_configuration_file_args '"tlsverify":' | grep 'true') ] || \
[ $(get_docker_cumulative_command_line_args '--tlsverify' | grep 'tlsverify') >/dev/null 2>&1 ]; then

0 comments on commit 269b71e

Please sign in to comment.
You can’t perform that action at this time.