Skip to content

Commit 7c8e313

Browse files
authored
Add simple MySQL CDC integration test (#9)
* Add simple MySQL CDC integration test * Increase integration test timeout * Log cluste state in integration tests * Reduce Flink cpu requests
1 parent e6d0b46 commit 7c8e313

File tree

6 files changed

+41
-34
lines changed

6 files changed

+41
-34
lines changed

.github/workflows/integration-tests.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,35 @@ jobs:
3434
- name: Deploy Dev Environment
3535
run: make deploy-dev-environment
3636
- name: Deploy Hoptimator
37-
run: make deploy deploy-samples
37+
run: make deploy
3838
- name: Wait for Readiness
39-
run: kubectl wait pod hoptimator --for condition=Ready --timeout=5m || kubectl describe pod hoptimator
39+
run: kubectl wait pod hoptimator --for condition=Ready --timeout=10m
40+
- name: Deploy Samples
41+
run: make deploy-samples
42+
- name: Wait for Flink Jobs
43+
run: |
44+
i=0
45+
while [ $i -ne 10 ]
46+
do
47+
kubectl wait flinkdeployments --all --for=jsonpath={.status.lifecycleState}=STABLE --timeout=1m && break || sleep 60
48+
i=$(($i+1))
49+
echo "No stable Flink jobs after $i tries..."
50+
done
4051
- name: Integration Tests
4152
run: make integration-tests
53+
- name: Capture Cluster State
54+
if: always()
55+
run: |
56+
kubectl describe pods
57+
kubectl describe deployments
58+
kubectl describe kafkas -n kafka
59+
kubectl describe flinkdeployments
60+
kubectl describe subscriptions
61+
- name: Capture Hoptimator Operator Logs
62+
if: always()
63+
run: kubectl logs $(kubectl get pods -l app=hoptimator-operator -o name)
64+
- name: Capture Flink Operator Logs
65+
if: always()
66+
run: kubectl logs $(kubectl get pods -l app.kubernetes.io/name=flink-kubernetes-operator -o name)
67+
4268

bin/hoptimator

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
kubectl exec -it hoptimator -c hoptimator -- ./hoptimator -n "" -p "" -u "jdbc:calcite:model=/etc/config/model.yaml" "$@"
3+
kubectl exec -it hoptimator -c hoptimator -- ./hoptimator --isolation=TRANSACTION_NONE -n "" -p "" -u "jdbc:calcite:model=/etc/config/model.yaml" -nn hoptimator "$@"

deploy/samples/subscriptions.yaml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
apiVersion: hoptimator.linkedin.com/v1alpha1
2-
kind: Subscription
3-
metadata:
4-
name: ceos
5-
spec:
6-
sql: SELECT CEO, NAME AS KEY FROM DATAGEN.COMPANY
7-
database: RAWKAFKA
8-
9-
---
10-
11-
apiVersion: hoptimator.linkedin.com/v1alpha1
12-
kind: Subscription
13-
metadata:
14-
name: companies
15-
spec:
16-
sql: SELECT KEY AS PAYLOAD, PAYLOAD AS KEY FROM RAWKAFKA."ceos"
17-
database: RAWKAFKA
18-
19-
---
201

212
apiVersion: hoptimator.linkedin.com/v1alpha1
223
kind: Subscription
@@ -26,4 +7,3 @@ spec:
267
sql: SELECT "quantity", "product_id" AS KEY FROM INVENTORY."products_on_hand"
278
database: RAWKAFKA
289

29-

etc/integration-tests.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11

2-
!connect "jdbc:calcite:model=./model.yaml" "" ""
3-
42
!set maxWidth 80
53
!table
64
!schemas
75

6+
-- built-in bounded tables
87
SELECT * FROM DATAGEN.PERSON;
98
SELECT * FROM DATAGEN.COMPANY;
109

10+
-- MySQL CDC tables
11+
SELECT * FROM INVENTORY."products_on_hand" LIMIT 1;
12+
13+
-- MySQL CDC -> Kafka
14+
SELECT * FROM RAWKAFKA."products" LIMIT 1;
15+

etc/readiness-probe.sql

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11

2-
!connect "jdbc:calcite:model=./model.yaml" "" ""
3-
4-
!set maxWidth 80
5-
!table
6-
!schemas
2+
!connect "jdbc:calcite:model=/etc/config/model.yaml" "" ""
73

84
SELECT * FROM DATAGEN.PERSON;
95
SELECT * FROM DATAGEN.COMPANY;
10-
6+
SELECT * FROM INVENTORY."products_on_hand" LIMIT 1;

hoptimator-operator/src/main/resources/FlinkDeployment.yaml.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ spec:
88
imagePullPolicy: Never
99
flinkVersion: v1_16
1010
flinkConfiguration:
11-
taskmanager.numberOfTaskSlots: "2"
11+
taskmanager.numberOfTaskSlots: "1"
1212
serviceAccount: flink
1313
jobManager:
1414
resource:
1515
memory: "2048m"
16-
cpu: 1
16+
cpu: .1
1717
taskManager:
1818
resource:
1919
memory: "2048m"
20-
cpu: 1
20+
cpu: .1
2121
job:
2222
entryClass: com.linkedin.hoptimator.flink.runner.FlinkRunner
2323
args:

0 commit comments

Comments
 (0)