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

Compare with Current View Page History

« Previous Version 6 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
      minikube start --mount --mount-string="/git/docker:/mnt" ## that's where docker repo was cloned

    3. /git/docker/policy-db-migrator/src/main/docker folder should contain the following file: drools_policy_init.sh
    4. kubectl create -f db.yaml
      kubectl get pods
      kubectl logs <db-migrator image name>
      kubectl delete -f db.yaml
      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 0800

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


- Fresh install Istanbul

DB migrator should configure the database on Istanbul scripts.

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

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 -f 0900 -t 0800

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 -f 0800 -t 0900

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


- Upgrade Istanbul to Honolulu (fail scenario) (need to confirm if target is by number)

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

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.

Command: /opt/app/policy/bin/db-migrator -s policyadmin​ -o downgrade -t 0900 -f 0800

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


- Downgrade Honolulu

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

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

Expected result: tables and indexes are all dropped.


- Partial upgrade

  • Upgrade to Honolulu
  • Drop a table that is to be altered in Istanbul
  • Upgrade to Istanbul

Command: /opt/app/policy/bin/db-migrator -s policyadmin​ -o upgrade -t 0800; drop table pdpdstatistics; db-migrator -s policyadmin​ -o upgrade -f 0800 -t 0900

Expected result: script halts at the given table's upgrade script and updates the metadata table to indicate that it failed


  • Downgrade to Honolulu

Command: /opt/app/policy/bin/db-migrator -s policyadmin​ -o downgrade -f 0900 -t 0800

Expected result: script skips the missing table and completes successfully (though it doesn't re-create the table)


  • Upgrade to Istanbul

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

Expected result: script halts at the given table's upgrade script and updates the metadata table to indicate that it failed


  • Manually recreate the table
  • Upgrade to Istanbul

Expected result: success


- Partial downgrade

  • Upgrade to Istanbul
  • Drop/Alter a table that is to be changed in Istanbul
  • Downgrade to Honolulu

Expected result: script halts at the given table's downgrade script and updates the metadata table to indicate that it failed


  • Upgrade to Istanbul

Expected result: script skips the missing table and completes successfully (though it doesn't re-create the table)


  • Downgrade to Honolulu

Expected result: script halts at the given table's upgrade script and updates the metadata table to indicate that it failed


  • Manually recreate the table
  • Downgrade to Honolulu

Expected result: success


- Metadata database fails (No new functionality being tested)

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 (No new functionality being tested)

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