Skip to content

Commit 668ea34

Browse files
authored
Integration tests and workflow (#4)
1 parent 041321a commit 668ea34

File tree

9 files changed

+83
-37
lines changed

9 files changed

+83
-37
lines changed

.github/workflows/gradle.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up JDK 11
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: '11'
23+
distribution: 'temurin'
24+
- name: Build
25+
run: make build
26+
- name: Create K8s Kind Cluster
27+
uses: helm/[email protected]
28+
with:
29+
cluster_name: 'kind'
30+
- name: Load Docker Images
31+
run: |
32+
kind load docker-image hoptimator
33+
kind load docker-image hoptimator-flink-runner
34+
- name: Deploy Dev Environment
35+
run: make deploy-dev-environment
36+
- name: Deploy Hoptimator
37+
run: make deploy deploy-samples
38+
- name: Wait for Readiness
39+
run: kubectl wait pod hoptimator --for condition=Ready --timeout=5m || kubectl describe pod hoptimator
40+
- name: Integration Tests
41+
run: make integration-tests
42+

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ COPY ./hoptimator-cli/run.sh ./hoptimator
44
COPY ./hoptimator-operator/run.sh ./hoptimator-operator
55
COPY ./hoptimator-cli/build/libs/hoptimator-cli-all.jar ./hoptimator-cli-all.jar
66
COPY ./hoptimator-operator/build/libs/hoptimator-operator-all.jar ./hoptimator-operator-all.jar
7+
COPY ./etc/* ./
78
COPY ./test-model.yaml ./test-model.yaml
89
ENTRYPOINT ["/bin/sh", "-c"]
910
CMD ["./hoptimator"]

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ build:
66
docker build . -t hoptimator
77
docker build hoptimator-flink-runner -t hoptimator-flink-runner
88

9+
bounce: build undeploy deploy deploy-samples
10+
11+
integration-tests:
12+
./bin/hoptimator --run=./integration-tests.sql
13+
echo "\nPASS"
14+
915
clean:
1016
./gradlew clean
1117

@@ -23,4 +29,10 @@ deploy-dev-environment:
2329
deploy:
2430
kubectl apply -f ./deploy/
2531

26-
.PHONY: build clean quickstart deploy-dev-environment deploy
32+
undeploy:
33+
kubectl delete -f ./deploy || echo "skipping"
34+
35+
deploy-samples:
36+
kubectl apply -f ./deploy/samples
37+
38+
.PHONY: build clean quickstart deploy-dev-environment deploy deploy-samples integration-tests

bin/hoptimator

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

33
docker build . -t hoptimator
4-
kubectl exec -it hoptimator -c hoptimator -- ./hoptimator
4+
kubectl exec -it hoptimator -c hoptimator -- ./hoptimator -n "" -p "" -u "jdbc:calcite:model=./test-model.yaml" "$@"
55

deploy/hoptimator-pod.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ spec:
88
image: docker.io/library/hoptimator
99
imagePullPolicy: Never
1010
command: ["sleep", "infinity"]
11+
readinessProbe:
12+
exec:
13+
command: ["./hoptimator", "--run=./readiness-probe.sql"]
14+
timeoutSeconds: 30
15+

etc/integration-tests.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
!connect "jdbc:calcite:model=./test-model.yaml" "" ""
3+
4+
!set maxWidth 80
5+
!table
6+
!schemas
7+
8+
SELECT * FROM DATAGEN.PERSON;
9+
SELECT * FROM DATAGEN.COMPANY;
10+

etc/readiness-probe.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
!connect "jdbc:calcite:model=./test-model.yaml" "" ""
3+
4+
!set maxWidth 80
5+
!table
6+
!schemas
7+
8+
SELECT * FROM DATAGEN.PERSON;
9+
SELECT * FROM DATAGEN.COMPANY;
10+

hoptimator-cli/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if [[ -f "$JAR" ]]; then
66
java \
77
--add-opens java.base/java.lang=ALL-UNNAMED \
88
--add-opens java.base/java.util=ALL-UNNAMED \
9-
-jar $JAR --verbose=true -n "" -p "" -u "jdbc:calcite:model=./test-model.yaml"
9+
-jar $JAR --verbose=true "$@"
1010
else
1111
echo "jar file not found; maybe forgot to build?"
1212
fi

0 commit comments

Comments
 (0)