From 7bbc39374eba5470f5a0c66c391b297c4f67b5b5 Mon Sep 17 00:00:00 2001 From: Magnus Skjegstad Date: Thu, 22 Jun 2017 16:29:35 +0200 Subject: [PATCH] tests: add build test for Docker for Mac blueprint Adds a new test group "linuxkit.build.blueprints" and a test for building blueprints/docker-for-mac.yml. Signed-off-by: Magnus Skjegstad --- .../200_blueprints/010_docker_for_mac/test.sh | 24 ++++++++++++++ test/cases/000_build/200_blueprints/group.sh | 31 +++++++++++++++++++ test/cases/group.sh | 1 + 3 files changed, 56 insertions(+) create mode 100644 test/cases/000_build/200_blueprints/010_docker_for_mac/test.sh create mode 100644 test/cases/000_build/200_blueprints/group.sh diff --git a/test/cases/000_build/200_blueprints/010_docker_for_mac/test.sh b/test/cases/000_build/200_blueprints/010_docker_for_mac/test.sh new file mode 100644 index 000000000..e227f6699 --- /dev/null +++ b/test/cases/000_build/200_blueprints/010_docker_for_mac/test.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# SUMMARY: Test the Docker for Mac blueprint +# LABELS: + +set -e + +# Source libraries. Uncomment if needed/defined +#. "${RT_LIB}" +. "${RT_PROJECT_ROOT}/_lib/lib.sh" + +IMAGE_NAME=docker-for-mac + +clean_up() { + # remove any files, containers, images etc + rm -rf ${IMAGE_NAME}* +} + +trap clean_up EXIT + +# Test code goes here +moby build "${LINUXKIT_BLUEPRINTS_DIR}/${IMAGE_NAME}.yml" + +exit 0 + diff --git a/test/cases/000_build/200_blueprints/group.sh b/test/cases/000_build/200_blueprints/group.sh new file mode 100644 index 000000000..ca0695d9d --- /dev/null +++ b/test/cases/000_build/200_blueprints/group.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# SUMMARY: Check that the blueprint YAML files work +# LABELS: + +group_init() { + # Group initialisation code goes here + return 0 +} + +group_deinit() { + # Group de-initialisation code goes here + return 0 +} + +CMD=$1 +case $CMD in +init) + group_init + res=$? + ;; +deinit) + group_deinit + res=$? + ;; +*) + res=1 + ;; +esac + +exit $res + diff --git a/test/cases/group.sh b/test/cases/group.sh index 732805cec..8f0229595 100644 --- a/test/cases/group.sh +++ b/test/cases/group.sh @@ -11,6 +11,7 @@ group_init() { [ -r "${LINUXKIT_TMPDIR}" ] && rm -rf "${LINUXKIT_TMPDIR}" mkdir "${LINUXKIT_TMPDIR}" echo "export LINUXKIT_EXAMPLES_DIR=${RT_PROJECT_ROOT}/../../examples" >> "${LINUXKIT_TMPDIR}/env.sh" + echo "export LINUXKIT_BLUEPRINTS_DIR=${RT_PROJECT_ROOT}/../../blueprints" >> "${LINUXKIT_TMPDIR}/env.sh" if rt_label_set "gcp"; then # If we run GCP tests, make sure it is configured