-
Notifications
You must be signed in to change notification settings - Fork 92
156 lines (137 loc) · 6.64 KB
/
jdbc-tests-db-collation.yml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: JDBC Tests DB COLLATION
on: [push, pull_request]
jobs:
run-babelfish-jdbc-tests:
env:
INSTALL_DIR: psql
DATABASE_COLLATION_NAME: bbf_unicode_cp1_ci_ai
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
id: checkout
- name: Install Dependencies
id: install-dependencies
if: always()
uses: ./.github/composite-actions/install-dependencies
- name: Build Modified Postgres
id: build-modified-postgres
if: always() && steps.install-dependencies.outcome == 'success'
uses: ./.github/composite-actions/build-modified-postgres
- name: Compile ANTLR
id: compile-antlr
if: always() && steps.build-modified-postgres.outcome == 'success'
uses: ./.github/composite-actions/compile-antlr
- name: Build Extensions
id: build-extensions
if: always() && steps.compile-antlr.outcome == 'success'
uses: ./.github/composite-actions/build-extensions
- name: Build tds_fdw Extension
id: build-tds_fdw-extension
if: always() && steps.build-extensions.outcome == 'success'
uses: ./.github/composite-actions/build-tds_fdw-extension
- name: Build vector Extension
id: build-vector-extension
if: always() && steps.build-tds_fdw-extension.outcome == 'success'
uses: ./.github/composite-actions/build-vector-extension
- name: Build PostGIS Extension
id: build-postgis-extension
if: always() && steps.build-vector-extension.outcome == 'success'
uses: ./.github/composite-actions/build-postgis-extension
- name: Install Extensions
id: install-extensions
if: always() && steps.build-postgis-extension.outcome == 'success'
uses: ./.github/composite-actions/install-extensions
with:
wal_level: logical
- name: Run JDBC Tests with DB level collation
id: jdbc
if: always() && steps.install-extensions.outcome == 'success'
timeout-minutes: 60
run: |
export PATH=/opt/mssql-tools/bin:$PATH
export PATH=~/${{env.INSTALL_DIR}}/bin:$PATH
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish
sudo ~/${{env.INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "update sys.babelfish_sysdatabases set default_collation = '${{env.DATABASE_COLLATION_NAME}}' where name = 'master';"
sudo ~/${{env.INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "select default_collation from sys.babelfish_sysdatabases where name = 'master';"
cd test/JDBC/
export isdbCollationMode=true
mvn -B -ntp test
unset isdbCollationMode
- name: Start secondary server
id: start-secondary
if: always() && steps.jdbc.outcome == 'success'
uses: ./.github/composite-actions/install-extensions
with:
psql_port: 5433
tsql_port: 8199
wal_level: logical
- name: Setup Publication and Subscription
id: setup-pub-sub
if: always() && steps.start-secondary.outcome == 'success'
run: |
~/${{env.INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "CREATE PUBLICATION my_pub;"
~/${{env.INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -p 5433 -c "CREATE SUBSCRIPTION my_sub CONNECTION 'host=localhost port=5432 user=jdbc_user dbname=babelfish_db password=12345678' PUBLICATION my_pub;"
- name: Run Replication Tests
id: replication
if: always() && steps.setup-pub-sub.outcome == 'success'
timeout-minutes: 60
run: |
export PATH=~/${{env.INSTALL_DIR}}/bin:$PATH
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish
sudo ~/${{env.INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -p 5433 -c "update sys.babelfish_sysdatabases set default_collation = '${{env.DATABASE_COLLATION_NAME}}' where name = 'master';"
sudo ~/${{env.INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -p 5433 -c "select default_collation from sys.babelfish_sysdatabases where name = 'master';"
cd test/JDBC/
export isdbCollationMode=true
export inputFilesPath=replication
mvn -B -ntp test
unset isdbCollationMode
- name: Cleanup babelfish database
id: cleanup
if: always() && steps.replication.outcome == 'success'
run: |
sudo ~/psql/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="babelfish_db" -f .github/scripts/cleanup_babelfish_database.sql
- name: Upload Log
if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure')
uses: actions/upload-artifact@v4
with:
name: postgres-log-jdbc
path: |
~/psql/data/logfile
~/psql/data_5433/logfile
# The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions
- name: Rename Test Summary Files
id: test-file-rename
if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure')
run: |
cd test/JDBC/Info
timestamp=`ls -Art | tail -n 1`
cd $timestamp
mv $timestamp.diff ../output-diff.diff
mv "$timestamp"_runSummary.log ../run-summary.log
cd ..
# get the replication output diff as well if it is present
dir_count=`ls | wc -l`
if [[ $dir_count -eq 2 ]];then
timestamp=`ls -rt | tail -n 2 | sort -r | tail -n 1`
cd $timestamp
mv $timestamp.diff ../replication-output-diff.diff
mv "$timestamp"_runSummary.log ../replication-run-summary.log
- name: Upload Run Summary
if: always() && steps.test-file-rename.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: run-summary.log
path: |
test/JDBC/Info/run-summary.log
test/JDBC/Info/replication-run-summary.log
- name: Upload Output Diff
if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure')
uses: actions/upload-artifact@v4
with:
name: jdbc-output-diff.diff
path: |
test/JDBC/Info/output-diff.diff
test/JDBC/Info/replication-output-diff.diff
- name: Check and upload coredumps
if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure')
uses: ./.github/composite-actions/upload-coredump