diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/calculate_version.sh | 136 | ||||
-rwxr-xr-x | utils/jenkins-jnlp-connect.sh | 50 | ||||
-rwxr-xr-x | utils/test/reporting/functest/reporting-status.py | 8 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/testcase_models.py | 3 |
4 files changed, 30 insertions, 167 deletions
diff --git a/utils/calculate_version.sh b/utils/calculate_version.sh deleted file mode 100755 index cf929dd5e..000000000 --- a/utils/calculate_version.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/bash -# SPDX-license-identifier: Apache-2.0 -############################################################################## -# Copyright (c) 2016 Ericsson AB and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -# Calculates and generates the version tag for the OPNFV objects: -# - Docker images -# - ISOs -# - Artifacts - -info () { - logger -s -t "Calculate_version.info" "$*" -} - - -error () { - logger -s -t "Calculate_version.error" "$*" - exit 1 -} - - -#Functions which calculate the version -function docker_version() { - docker_image=$1 - url_repo="https://registry.hub.docker.com/v2/repositories/${docker_image}/" - url_tag="https://registry.hub.docker.com/v2/repositories/${docker_image}/tags/" - status=$(curl -s --head -w %{http_code} ${url_repo} -o /dev/null) - if [ "${status}" != "200" ]; then - error "Cannot access ${url_repo}. Does the image ${docker_image} exist?" - fi - tag_json=$(curl $url_tag 2>/dev/null | python -mjson.tool | grep ${BASE_VERSION} | head -1) - #e.g. tag_json= "name": "brahmaputra.0.2", - #special case, for dovetail, not sync with release, tag_json name not headed with arno, etc - if [ "${tag_json}" == "" ]; then - echo ${BASE_VERSION}.0 - else - tag=$(echo $tag_json | awk '{print $2}' | sed 's/\,//' | sed 's/\"//g') - #e.g.: tag=brahmaputra.0.2 - #special case, for dovetail, not sync with release - tag_current_version=$(echo $tag | sed 's/.*\.//') - tag_new_version=$(($tag_current_version+1)) - #e.g.: tag=brahmaputra.0.3 - echo ${BASE_VERSION}.${tag_new_version} - fi -} - - -function artifact_version() { - # To be done - error "Not supported yet..." -} - - -STORAGE_TYPES=(docker artifactrepo) -TYPE="" -NAME="" - - -usage="Calculates the version text of one of the following objects. - -usage: - bash $(basename "$0") [-h|--help] -t|--type docker|artifactrepo -n|--name <object_name> - -where: - -h|--help show this help text - -t|--type specify the storage location - -n|--name name of the repository/object - -examples: - $(basename "$0") -t docker -n opnfv/functest - $(basename "$0") -t artifactrepo -n fuel" - - - - -# Parse parameters -while [[ $# > 0 ]] - do - key="$1" - case $key in - -h|--help) - echo "$usage" - exit 0 - shift - ;; - -t|--type) - TYPE="$2" - shift - ;; - -n|--name) - NAME="$2" - shift - ;; - *) - error "unknown option $1" - exit 1 - ;; - esac - shift # past argument or value -done - -if [ -z "$BASE_VERSION" ]; then - error "Base version must be specified as environment variable. Ex.: export BASE_VERSION='brahmaputra.0'" -fi - -if [ "${TYPE}" == "" ]; then - error "Please specify the type of object to get the version from. $usage" -fi - -if [ "${NAME}" == "" ]; then - error "Please specify the name for the given storage type. $usage" -fi - -not_in=1 -for i in "${STORAGE_TYPES[@]}"; do - if [[ "${TYPE}" == "$i" ]]; then - not_in=0 - fi -done -if [ ${not_in} == 1 ]; then - error "Unknown type: ${TYPE}. Available storage types are: [${STORAGE_TYPES[@]}]" -fi - - -#info "Calculating version for object '${TYPE}' with arguments '${INFO}'..." -if [ "${TYPE}" == "docker" ]; then - docker_version $NAME - -elif [ "${TYPE}" == "artifactrepo" ]; then - artifact_version $NAME -fi diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh index 9ef4298ef..8337684ec 100755 --- a/utils/jenkins-jnlp-connect.sh +++ b/utils/jenkins-jnlp-connect.sh @@ -30,8 +30,6 @@ EOF } main () { - dir=$(cd $(dirname $0); pwd) - #tests if [[ -z $jenkinsuser || -z $jenkinshome ]]; then echo "jenkinsuser or home not defined, please edit this file to define it" @@ -60,17 +58,6 @@ main () { fi fi - - if [ -d /etc/monit/conf.d ]; then - monitconfdir="/etc/monit/conf.d/" - elif [ -d /etc/monit.d ]; then - monitconfdir="/etc/monit.d" - else - echo "Could not determine the location of the monit configuration file." - echo "Make sure monit is installed." - exit 1 - fi - #make pid dir pidfile="/var/run/$jenkinsuser/jenkins_jnlp_pid" if ! [ -d /var/run/$jenkinsuser/ ]; then @@ -94,29 +81,39 @@ main () { exit 1 fi fi - fi - makemonit () { - echo "Writing the following as monit config:" + if [ -d /etc/monit/conf.d ]; then + monitconfdir="/etc/monit/conf.d/" + elif [ -d /etc/monit.d ]; then + monitconfdir="/etc/monit.d" + else + echo "Could not determine the location of the monit configuration file." + echo "Make sure monit is installed." + exit 1 + fi + + makemonit () { + echo "Writing the following as monit config:" cat << EOF | tee $monitconfdir/jenkins check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid -start program = "/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@' with timeout 60 seconds" +start program = "/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds" stop program = "/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'" EOF - } + } - if [[ -f $monitconfdir/jenkins ]]; then - #test for diff - if [[ "$(diff $monitconfdir/jenkins <(echo "\ + if [[ -f $monitconfdir/jenkins ]]; then + #test for diff + if [[ "$(diff $monitconfdir/jenkins <(echo "\ check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid -start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@' with timeout 60 seconds\" +start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds\" stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\ ") )" ]]; then - echo "Updating monit config..." + echo "Updating monit config..." + makemonit $@ + fi + else makemonit $@ fi - else - makemonit $@ fi if [[ $started_monit == "true" ]]; then @@ -167,7 +164,8 @@ usage: $0 [OPTIONS] -t test the connection string by connecting without monit -f test firewall -Example: $0 -j /home/jenkins/ -u jenkins -n lab1 -s 727fdefoofoofoofoofoofoofof800 +Example: $0 -j /home/jenkins -u jenkins -n lab1 -s 727fdefoofoofoofoofoofoofof800 +note: a trailing slash on -j /home/jenkins will break the script EOF exit 1 diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/functest/reporting-status.py index cb13b099c..66bdd57c1 100755 --- a/utils/test/reporting/functest/reporting-status.py +++ b/utils/test/reporting/functest/reporting-status.py @@ -55,25 +55,25 @@ logger.info("*******************************************") # Retrieve test cases of Tier 1 (smoke) config_tiers = functest_yaml_config.get("tiers") -# we consider Tier 1 (smoke),2 (sdn suites) and 3 (features) +# we consider Tier 1 (smoke),2 (features) # to validate scenarios # Tier > 4 are not used to validate scenarios but we display the results anyway # tricky thing for the API as some tests are Functest tests # other tests are declared directly in the feature projects for tier in config_tiers: - if tier['order'] > 0 and tier['order'] < 3: + if tier['order'] > 0 and tier['order'] < 2: for case in tier['testcases']: if case['name'] not in blacklist: testValid.append(tc.TestCase(case['name'], "functest", case['dependencies'])) - elif tier['order'] == 3: + elif tier['order'] == 2: for case in tier['testcases']: if case['name'] not in blacklist: testValid.append(tc.TestCase(case['name'], case['name'], case['dependencies'])) - elif tier['order'] > 3: + elif tier['order'] > 2: for case in tier['testcases']: if case['name'] not in blacklist: otherTestCases.append(tc.TestCase(case['name'], diff --git a/utils/test/testapi/opnfv_testapi/resources/testcase_models.py b/utils/test/testapi/opnfv_testapi/resources/testcase_models.py index c9dce6088..e1f2fb650 100644 --- a/utils/test/testapi/opnfv_testapi/resources/testcase_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/testcase_models.py @@ -41,7 +41,8 @@ class TestcaseUpdateRequest(object): @swagger.model() class Testcase(object): - def __init__(self): + def __init__(self, _id=None, name=None, project_name=None, + description=None, url=None, creation_date=None): self._id = None self.name = None self.project_name = None |