You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Configuration for testing with minikube:

Clone policy-docker and navigate to policy-db-migrator folder

On a terminal do the following

  1. Download and install minikube on linux
  2. minikube config set driver docker
  3. minikube start -- mount -- mount-string ="/git/docker:/mnt" (that's where docker repo was cloned)

/git/docker/policy-db-migrator/src/main/docker folder should contain the following files: db-migrator, drools_policy_init.sh, prepare_downgrade.sh and prepare_upgrade.sh

  1. copy pom.xml to /git/docker/policy-db-migrator
  2. cd /git/docker/policy-db-migrator
  3. eval $(minikube -p minikube docker-env)
  4. mvn clean install (this will install the db-migrator image to minikube docker)
  5. ssh -i $(minikube ssh-key) docker@$(minikube ip)
  6. docker images – you should see the onap/policy-db-migrator image
  7. exit out of minikube
  8. kubectl create -f db.yaml
  9. kubectl get pods
  10. kubectl logs <db-migrator image name>
  11. kubectl delete -f db.yaml
  12. minikube stop


Test scenarios:

- Fresh install Honolulu

DB migrator should configure the database on Honolulu scripts.

Schema shouldn't exist

Command: /opt/app/policy/bin/db-migrator -s policyadmin​ -o upgrade -t honolulu

Expected result: schema is created and populated with tables and indexes.


- Fresh install Istanbul

DB migrator should configure the database on Istanbul scripts.

Expected result: schema is created and populated with tables and indexes.


- Downgrade Istanbul to Honolulu

DB migrator should change tables and indexes based on Istanbul downgrade scripts.

Command: /opt/app/policy/bin/db-migrator -s policyadmin​ -o downgrade

Expected result: tables and indexes altered, but no data loss.


- Upgrade Honolulu to Istanbul

DB migrator should change tables and indexes based on Istanbul upgrade scripts.

Command: /opt/app/policy/bin/db-migrator -s policyadmin​ -o upgrade

Expected result: tables and indexes altered, but no data loss.


- Upgrade Istanbul to Honolulu (fail scenario)

DB migrator should fail when upgrading to a down version.

Expected result: no changes on database, script has error result.


- Downgrade Honolulu to Istanbul (fail scenario)

DB migrator should fail when downgrading to an upper version.

Expected result: no changes on database, script has error result.


- Downgrade Honolulu

DB migrator should change tables and indexes based on Honolulu downgrade scripts.

Expected result: tables and indexes are all dropped.


- Partial upgrade

TBD


- Partial downgrade

TBD


- Metadata database fails

When DB migrator starts, a metadata for historical changes is created/updated.

If metadata schema verification fails, script should return error.

Expected result: no changes on database, script has error result.


- Database information check fails

Username and password for accessing/creating schemas are invalid.

Expected result: no changes on database, script has error result.


- Database cannot connect

Server is unavailable.

Expected result: no changes on database, script has error result.


- Current schema already exists

If operation is valid, scripts should run with no issues.

Expected result: schema is populated with tables and indexes or tables and indexes are altered.

  • No labels