Functional Test Updates for I Release
[nonrtric.git] / test / auto-test / verify-jobs-nonrtric.sh
1 #!/bin/bash
2
3 #  ============LICENSE_START===============================================
4 #  Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
5 #  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
6 #  ========================================================================
7 #  Licensed under the Apache License, Version 2.0 (the "License");
8 #  you may not use this file except in compliance with the License.
9 #  You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 #  Unless required by applicable law or agreed to in writing, software
14 #  distributed under the License is distributed on an "AS IS" BASIS,
15 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 #  See the License for the specific language governing permissions and
17 #  limitations under the License.
18 #  ============LICENSE_END=================================================
19 #
20
21 TEST_DIRECTORY="test/auto-test"
22 TEST_SCRIPT="./Suite-Verify-jobs.sh"
23 DOCKER_COMPOSE_VERSION="v2.21.0"
24
25 # Check if jq is installed, and install it if not
26 if ! command -v jq &> /dev/null; then
27     echo "Installing jq..."
28     sudo apt-get update
29     sudo apt-get install -y jq
30 fi
31
32 # Function to install Docker Compose version 2
33 install_docker_compose() {
34     echo "Installing Docker Compose version 2..."
35     sudo curl -L "https://github.com/docker/compose/releases/download/"$DOCKER_COMPOSE_VERSION"/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
36     sudo chmod +x /usr/local/bin/docker-compose
37     sudo ln -s /usr/local/bin/docker-compose /usr/libexec/docker/cli-plugins/docker-compose
38 }
39
40 # Function to remove Docker Compose
41 remove_docker_compose() {
42     echo "Removing Docker Compose..."
43     sudo rm /usr/local/bin/docker-compose
44 }
45
46 # Check if docker-compose is installed, and install it if not
47 if ! command -v docker-compose &> /dev/null; then
48     install_docker_compose
49 fi
50
51 cd "$TEST_DIRECTORY"
52 sudo chmod 775 "$TEST_SCRIPT"
53 "$TEST_SCRIPT" remote-remove docker release --env-file ../common/test_env-oran-h-release.sh
54
55 # Remove docker-compose after tests are done
56 if command -v docker-compose &> /dev/null; then
57     remove_docker_compose
58 fi
59
60 # Remove jq after tests are done
61 if command -v jq &> /dev/null; then
62     echo "Removing jq..."
63     sudo apt-get remove -y jq
64 fi