-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.sh
executable file
·53 lines (36 loc) · 1.51 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -Eeu
SCRIPT_DIR=$(dirname $(realpath "$0"))
cd $SCRIPT_DIR
source ../../bashsrc
step 1
echo "Deploying version 1:> rdbm -c test.cfg --target=1 migrate; with params:"
cat test.cfg
../../rdbm -c test.cfg --target=1 --db_port $1 migrate
# Comparison
echo
echo "Dumping schema version 1 in YAML format:> rdbm -c test.cfg snapshot"
../../rdbm -c test.cfg --db_port $1 --snapshot_to=test1_result.out.yaml snapshot
echo "Comparing YAML files: diff output vs expected"
diff -B test1_result.yaml test1_result.out.yaml
echo
echo "Dumping schema version 1 in SQL format:> pg_dump -s -h "
pg_dump -s -h localhost -p $1 -U postgres | grep -Ev "\-\-|SET|COMMENT ON|pg_catalog.set_config" > test1_result.out.sql
echo "Comparing SQL files: diff output vs expected"
diff -B test1_result.sql test1_result.out.sql
step 2
echo "Deploying version 2:> rdbm -c test.cfg --target=2 migrate; with params:"
cat test.cfg
../../rdbm -c test.cfg --db_port $1 --target=2 migrate
# Comparison
echo
echo "Dumping schema version 2 in YAML format:> rdbm -c test.cfg snapshot"
../../rdbm -c test.cfg --db_port $1 --snapshot_to=test2_result.out.yaml snapshot
echo "Comparing YAML files: diff output vs expected"
diff -B test2_result.yaml test2_result.out.yaml
echo
echo "Dumping schema version 2 in SQL format:> pg_dump -s -h "
pg_dump -s -h localhost -p $1 -U postgres | grep -Ev "\-\-|SET|COMMENT ON|pg_catalog.set_config" > test2_result.out.sql
echo "Comparing SQL files: diff output vs expected"
diff -B test2_result.sql test2_result.out.sql
echo