diff options
author | demskeq8 <alexander.dehn@highstreet-technologies.com> | 2021-06-02 15:50:12 +0200 |
---|---|---|
committer | demskeq8 <alexander.dehn@highstreet-technologies.com> | 2021-07-19 17:03:06 +0200 |
commit | cb75097bcd353161aa91fdbf420ec92d01e31ec1 (patch) | |
tree | 656a8fc862669e7bbcdf4e8769eb093c2637ddc4 /csit/scripts/sdnr/sdnr-teardown.sh | |
parent | 7af41819f26441ec614229028b38ca856586cc6b (diff) |
[SNDC-CSIT] Provide test deployment for SDNC/R
Integration tests for wt feature set
Issue-ID: SDNC-1562
Signed-off-by: demskeq8 <alexander.dehn@highstreet-technologies.com>
Change-Id: If579b6f23b3e6291dc49b10952b23da2626e45b7
Former-commit-id: c15899f037944cabbcdee16460427b0f813599c3
Diffstat (limited to 'csit/scripts/sdnr/sdnr-teardown.sh')
-rwxr-xr-x | csit/scripts/sdnr/sdnr-teardown.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/csit/scripts/sdnr/sdnr-teardown.sh b/csit/scripts/sdnr/sdnr-teardown.sh new file mode 100755 index 00000000..eeb729e0 --- /dev/null +++ b/csit/scripts/sdnr/sdnr-teardown.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# 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. +# +# Modifications copyright (c) 2018 AT&T Intellectual Property +# + +if [[ -z $WORKSPACE ]]; then + CUR_PATH="`dirname \"$0\"`" # relative path + CUR_PATH="`( cd \"$CUR_PATH\" && pwd )`" # absolutized and normalized + if [ -z "$CUR_PATH" ] ; then + echo "Permission error!" + exit 1 + fi + + # define location of workpsace based on where the current script is + WORKSPACE=$(cd $CUR_PATH/../../ && pwd) +fi + +if [[ -z $SCRIPTS ]]; then + SCRIPTS=$(cd $WORKSPACE/scripts && pwd) +fi + +source ${SCRIPTS}/sdnr/sdnrEnv_Common.sh +env_file="--env-file ${SCRIPTS}/sdnr/docker-compose/.env" + +function sdnr_teardown() { + running_containers=$(docker ps -aq) + if [ -z "$running_containers" ] + then + echo "No containers to get logs from!" + else + echo "Getting logs from containers!" + running_containers_array=($(echo "$running_containers" | tr ' ' '\n')) + mkdir -p ${WORKSPACE}/archives/getallinfo + for i in "${running_containers_array[@]}" + do + echo "Getting logs from container $i" + docker logs $i >> ${WORKSPACE}/archives/getallinfo/$i.log 2>&1 + done + fi + echo "Starting teardown!" + # removes sdnrdb, sdnr AND all of the rest of the containers (--remove-orphans) + docker rm -f $(docker ps -aq -f name=ntsim*) + docker rm -f $(docker ps -aq -f name=nts-*) + docker rm -f $(docker ps -aq -f name=NTS_Manager*) + docker rm -f $(docker ps -aq -f name=NTS-Manager*) + docker-compose $env_file -f ${WORKSPACE}/scripts/sdnr/docker-compose/docker-compose-single-sdnr.yaml down --remove-orphans + docker network rm integration +} |