#!/usr/bin/env bash

MODULE_DOCKER_ENGINE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$MODULE_DOCKER_ENGINE_DIR/../../.." && pwd)"

# shellcheck source=lib/ui.sh
source "$PROJECT_ROOT/lib/ui.sh"
# shellcheck source=lib/log.sh
source "$PROJECT_ROOT/lib/log.sh"
# shellcheck source=core/runtime.sh
source "$PROJECT_ROOT/core/runtime.sh"
# shellcheck source=modules/containers/docker-engine/module.sh
source "$MODULE_DOCKER_ENGINE_DIR/module.sh"

runtime_init "$PROJECT_ROOT"
log_init

if ! command -v docker >/dev/null 2>&1; then
  printf 'docker-engine test SKIPPED: docker not installed\n'
  exit 0
fi

if module_docker_engine_test; then
  printf 'docker-engine test OK\n'
else
  printf 'docker-engine test FAILED\n' >&2
  exit 1
fi
