diff options
author | Jim Hahn <jrh3@att.com> | 2021-08-18 13:26:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-08-18 13:26:49 +0000 |
commit | 19ea8c41d6539a602a8f09a357b662723cccae12 (patch) | |
tree | d54306ffd652b5cc44f63121c82c99f2d2b3e66f | |
parent | a179ce9586bdbd52edba9bb794473bd34f8dd02d (diff) | |
parent | 88a991b939a4c469b9d2c1c392ea4f683cdc8f7a (diff) |
Merge "Add db-migrator to CSIT tests"
-rwxr-xr-x | csit/db_migrator_policy_init.sh | 35 | ||||
-rw-r--r-- | csit/detmVers.sh | 5 | ||||
-rw-r--r-- | csit/docker-compose-all.yml | 27 |
3 files changed, 65 insertions, 2 deletions
diff --git a/csit/db_migrator_policy_init.sh b/csit/db_migrator_policy_init.sh new file mode 100755 index 00000000..d7a7b3f7 --- /dev/null +++ b/csit/db_migrator_policy_init.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 2021 Nordix Foundation. +# ============================================================================= +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +export POLICY_HOME=/opt/app/policy +export SQL_USER=${MYSQL_USER} +export SQL_PASSWORD=${MYSQL_PASSWORD} + +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} + +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report + +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade +rc=$? + +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report + +nc -l -p 6824 + +exit $rc diff --git a/csit/detmVers.sh b/csit/detmVers.sh index a20cdf63..ce545e0f 100644 --- a/csit/detmVers.sh +++ b/csit/detmVers.sh @@ -1,5 +1,6 @@ # ============LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. +# Modification Copyright 2021. Nordix Foundation. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -64,3 +65,7 @@ echo POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION} POLICY_CLAMP_VERSION=$(getVersion clamp) export POLICY_CLAMP_VERSION=${POLICY_CLAMP_VERSION:0:5}-SNAPSHOT-latest echo POLICY_CLAMP_VERSION=${POLICY_CLAMP_VERSION} + +POLICY_DOCKER_VERSION=$(getVersion docker) +export POLICY_DOCKER_VERSION=${POLICY_DOCKER_VERSION:0:5}-SNAPSHOT-latest +echo POLICY_DOCKER_VERSION=${POLICY_DOCKER_VERSION} diff --git a/csit/docker-compose-all.yml b/csit/docker-compose-all.yml index d271f5c6..50b20548 100644 --- a/csit/docker-compose-all.yml +++ b/csit/docker-compose-all.yml @@ -2,6 +2,7 @@ # ===========LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. # Modifications Copyright (C) 2021 Bell Canada. All rights reserved. +# Modification Copyright 2021. Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,6 +29,27 @@ services: - ./config/db:/docker-entrypoint-initdb.d:ro expose: - 3306 + policy-db-migrator: + image: nexus3.onap.org:10001/onap/policy-db-migrator:${POLICY_DOCKER_VERSION} + container_name: policy-db-migrator + hostname: policy-db-migrator + depends_on: + - mariadb + expose: + - 6824 + env_file: config/db/db.conf + environment: + SQL_DB: policyadmin + SQL_HOST: mariadb + volumes: + - ./db_migrator_policy_init.sh:/opt/app/policy/bin/db_migrator_policy_init.sh:ro + - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro + entrypoint: /opt/app/policy/bin/wait_for_port.sh + command: [ + '-c', + '/opt/app/policy/bin/db_migrator_policy_init.sh', + 'mariadb', '3306' + ] simulator: image: nexus3.onap.org:10001/onap/policy-models-simulator:${POLICY_MODELS_VERSION} container_name: simulator @@ -56,7 +78,7 @@ services: image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} container_name: policy-api depends_on: - - mariadb + - policy-db-migrator hostname: policy-api expose: - 6969 @@ -67,7 +89,8 @@ services: entrypoint: ./wait_for_port.sh command: [ '-c', './policy-api.sh', - 'mariadb', '3306' + 'mariadb', '3306', + 'policy-db-migrator', '6824' ] pap: image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} |