Skip to content

Commit

Permalink
Integration tests and workflow (linkedin#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannedolan authored May 9, 2023
1 parent 041321a commit 668ea34
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 37 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/gradle.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build
run: make build
- name: Create K8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: 'kind'
- name: Load Docker Images
run: |
kind load docker-image hoptimator
kind load docker-image hoptimator-flink-runner
- name: Deploy Dev Environment
run: make deploy-dev-environment
- name: Deploy Hoptimator
run: make deploy deploy-samples
- name: Wait for Readiness
run: kubectl wait pod hoptimator --for condition=Ready --timeout=5m || kubectl describe pod hoptimator
- name: Integration Tests
run: make integration-tests

1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ COPY ./hoptimator-cli/run.sh ./hoptimator
COPY ./hoptimator-operator/run.sh ./hoptimator-operator
COPY ./hoptimator-cli/build/libs/hoptimator-cli-all.jar ./hoptimator-cli-all.jar
COPY ./hoptimator-operator/build/libs/hoptimator-operator-all.jar ./hoptimator-operator-all.jar
COPY ./etc/* ./
COPY ./test-model.yaml ./test-model.yaml
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./hoptimator"]
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ build:
docker build . -t hoptimator
docker build hoptimator-flink-runner -t hoptimator-flink-runner

bounce: build undeploy deploy deploy-samples

integration-tests:
./bin/hoptimator --run=./integration-tests.sql
echo "\nPASS"

clean:
./gradlew clean

Expand All @@ -23,4 +29,10 @@ deploy-dev-environment:
deploy:
kubectl apply -f ./deploy/

.PHONY: build clean quickstart deploy-dev-environment deploy
undeploy:
kubectl delete -f ./deploy || echo "skipping"

deploy-samples:
kubectl apply -f ./deploy/samples

.PHONY: build clean quickstart deploy-dev-environment deploy deploy-samples integration-tests
2 changes: 1 addition & 1 deletion bin/hoptimator
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

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

5 changes: 5 additions & 0 deletions deploy/hoptimator-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ spec:
image: docker.io/library/hoptimator
imagePullPolicy: Never
command: ["sleep", "infinity"]
readinessProbe:
exec:
command: ["./hoptimator", "--run=./readiness-probe.sql"]
timeoutSeconds: 30

10 changes: 10 additions & 0 deletions etc/integration-tests.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

!connect "jdbc:calcite:model=./test-model.yaml" "" ""

!set maxWidth 80
!table
!schemas

SELECT * FROM DATAGEN.PERSON;
SELECT * FROM DATAGEN.COMPANY;

10 changes: 10 additions & 0 deletions etc/readiness-probe.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

!connect "jdbc:calcite:model=./test-model.yaml" "" ""

!set maxWidth 80
!table
!schemas

SELECT * FROM DATAGEN.PERSON;
SELECT * FROM DATAGEN.COMPANY;

2 changes: 1 addition & 1 deletion hoptimator-cli/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ -f "$JAR" ]]; then
java \
--add-opens java.base/java.lang=ALL-UNNAMED \
--add-opens java.base/java.util=ALL-UNNAMED \
-jar $JAR --verbose=true -n "" -p "" -u "jdbc:calcite:model=./test-model.yaml"
-jar $JAR --verbose=true "$@"
else
echo "jar file not found; maybe forgot to build?"
fi

0 comments on commit 668ea34

Please sign in to comment.