armada/tools/armada_image_run.sh
One-Fine-Day ec252e7069 Updated Makefile
ARMADA-29: CI/CD Armada Testing Framework Entrypoints defined

It does not appear the the docker run command to call tox tests/unit
is necessary.  The Makefile already includes several testing checks.

Added a few additional targets as specified in the upc-integration
code-convenstions to satisfy the clcp Makefile standards.

Change-Id: Ia920a856ed6d607fcf38d5f85dbb9a0c8aae4fa6
2018-03-15 12:40:19 -04:00

62 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
IMAGE=$1
set -x
# Create container
function create {
docker run \
-v $(pwd)/etc:/etc \
-d \
--name armada-api-test \
-p 127.0.0.1:8000:8000 \
${IMAGE} \
server
}
# Verify container was successfully created
# If not successful, print out logs
function health_check {
GOOD="HTTP/1.1 204 No Content"
if curl\
-m 5 \
-v \
--silent \
127.0.0.1:8000/api/v1.0/health \
--stderr - \
| grep "$GOOD"
then
echo "Health Check Success"
exit 0
else
echo "Failed Health Check"
docker logs armada-api-test
exit 1
fi
}
# Remove container
function cleanup {
docker rm -fv armada-api-test
}
trap cleanup EXIT
create
health_check