-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathintegration-tests-against-emulator.yaml
More file actions
182 lines (167 loc) · 6.64 KB
/
integration-tests-against-emulator.yaml
File metadata and controls
182 lines (167 loc) · 6.64 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
on:
schedule:
- cron: "0 0 * * *"
push:
branches:
- master
pull_request:
name: integration-tests-against-emulator
jobs:
integration-tests:
runs-on: self-hosted
env:
# set PostgreSQL related environment variables
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGDATABASE: postgres
PGPASSWORD: postgres
# set MySQL related environment variables
DB_HOST: localhost
MYSQLHOST: localhost
MYSQLPORT: 3306
MYSQLUSER: root
MYSQLDATABASE: test_interleave_table_data
MYSQLDB_FKACTION: test_foreign_key_action_data
MYSQLDB_CHECK_CONSTRAINT: test_mysql_checkconstraint
MYSQLDB_DATA_TYPES: test_mysql_data_types
MYSQLPWD: root
# set DynamoDB related environment variables
AWS_ACCESS_KEY_ID: dummyId
AWS_SECRET_ACCESS_KEY: dummyKey
AWS_REGION: dummyRegion
DYNAMODB_ENDPOINT_OVERRIDE: http://localhost:8000
# sql server envs
# Password for connection as SA
MSSQL_SA_PASSWORD: tCUE9c1&Ucp0
services:
spanner_emulator:
image: gcr.io/cloud-spanner-emulator/emulator:1.5.40
ports:
- 9010:9010
- 9020:9020
postgres:
image: postgres:9.6
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mariadb:
image: mariadb:10.11
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
ports:
- 3306:3306
# needed because the mysql container does not provide a healthcheck
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
dynamodb_emulator:
image: amazon/dynamodb-local:1.16.0
ports:
- 8000:8000
options: --workdir /home/dynamodblocal --health-cmd "curl --fail http://127.0.0.1:8000/shell/ || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
SA_PASSWORD: ${{env.MSSQL_SA_PASSWORD}}
MSSQL_PID: Express
ACCEPT_EULA: Y
ports:
- 1433:1433
options:
--health-cmd "/opt/mssql-tools18/bin/sqlcmd -U sa -P $SA_PASSWORD -Q 'select 1' -b -No -o /dev/null"
--health-interval 10s --health-timeout 5s --health-retries 3
oracle:
image: oracleinanutshell/oracle-xe-11g
ports:
- 1521:1521
steps:
- uses: actions/checkout@v3
# init a PostgresSQL database from the test_data
- name: Install PostgreSQL 12 client required for loading .sql files
run: |
sudo apt-get update
sudo apt-get -yq install postgresql-client
- run: psql --version
- run: psql -f test_data/pg_dump.test.out
# init a MySQL database from the test_data
- run: mysql --version
- run: mysql -v -P 3306 --protocol=tcp -u root -proot test < test_data/mysqldump.test.out
- run: mysql -v -P 3306 --protocol=tcp -u root -proot < test_data/mysql_interleave_dump.test.out
- run: mysql -v -P 3306 --protocol=tcp -u root -proot < test_data/mysql_foreignkeyaction_dump.test.out
- run: mysql -v -P 3306 --protocol=tcp -u root -proot < test_data/mysql_checkconstraint_dump.test.out
- run: mysql -v -P 3306 --protocol=tcp -u root -proot < test_data/mysql_data_types_dump.test.out
# init sql server with test_data
# since we use ubuntu-latest container, we should ensure that the path matches the latest from https://packages.microsoft.com/config/ubuntu/
# while its possible to infer the latest from the path in the run script, it will make the run section more complex and hard to maintian.
- name: Install sqlcmd required for loading .sql files
run: /opt/mssql-tools18/bin/sqlcmd -C -?
- run: /opt/mssql-tools18/bin/sqlcmd -U sa -P ${MSSQL_SA_PASSWORD} -i test_data/sqlserver.test.out -C
# sqlplus set up init oracle db.
- name: Install sqlplus required for loading .sql files
run: sqlplus SYS/oracle@127.0.0.1:1521/xe as sysdba @test_data/oracle.test.out
# create a spanner instance
- uses: actions/setup-python@v4
with:
python-version: '3.14'
- uses: google-github-actions/setup-gcloud@v0
with:
version: "410.0.0"
- run: gcloud info
- run: gcloud config list
- run: gcloud config set auth/disable_credentials true
- run: gcloud config set project emulator-test-project
- run: gcloud config set api_endpoint_overrides/spanner http://localhost:9020/
- run: gcloud spanner instances create test-instance --config=emulator-config --description="Test Instance" --nodes=1
- name: Setup cypress dependency
run: |
sudo apt-get install -yq libgtk2.0-0t64 libgtk-3-0t64 libgbm-dev libnotify-dev libnss3 libxss1 libasound2t64 libxtst6 xauth xvfb
sudo apt-get install build-essential
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Install Dependencies
run: |
cd ui
npm install
npm run build
- name: Start Local Server
run: |
cd ui
npm start &
- name: Wait for Local Server to Start
run: npx wait-on http://localhost:4200 -t 30000
- name: Cypress run
run: |
cd ui
npm install cypress --save-dev
npx cypress run
- uses: actions/setup-go@v2
with:
go-version: "1.24"
- run: go version
- run: go build
- run: go test -v ./...
env:
SPANNER_EMULATOR_HOST: localhost:9010
SPANNER_MIGRATION_TOOL_TESTS_GCLOUD_PROJECT_ID: emulator-test-project
SPANNER_MIGRATION_TOOL_TESTS_GCLOUD_INSTANCE_ID: test-instance
IMPORT_CMD_SKIP_DIALECT_VALIDATION: true