Skip to content

Commit

Permalink
#246: Add second test to CI generator script job
Browse files Browse the repository at this point in the history
- This is to compare data from master and the branch where the CI job was started from
  • Loading branch information
MRichards99 committed Aug 11, 2021
1 parent 1130f4e commit 86eeaeb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,32 @@ jobs:
- name: Get SQL dump of new dummy data
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_2.sql

# Tests that the generator script produces consistent data over two separate runs
- name: Diff SQL dumps
run: diff -s ~/generator_script_dump_1.sql ~/generator_script_dump_2.sql


# Drop and re-create icatdb to remove generated data
- name: Drop icatdb
run: mysql -picatdbuserpw -uicatdbuser -e 'DROP DATABASE icatdb;'
- name: Create icatdb
run: mysql -picatdbuserpw -uicatdbuser -e 'CREATE DATABASE icatdb;'
# Regenerate table structure of icatdb
- name: Reinstall ICAT Server
run: cd /home/runner/install/icat.server; ./setup -vv install

- name: Checkout DataGateway API (master)
uses: actions/checkout@v2
with:
ref: master

- name: Is API on master?
run: pwd; git status
- name: Add dummy data to icatdb
run: pwd; poetry run python -m util.icat_db_generator
- name: Get SQL dump of dummy data from master's generator script
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_master.sql

# Tests that the generator script produces the same data as is produced with master's version
- name: Diff SQL dumps
run: diff -s ~/generator_script_dump_master.sql ~/generator_script_dump_1.sql

0 comments on commit 86eeaeb

Please sign in to comment.