forked from seglo/kafka-lag-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minikube integration tests (seglo#346)
- Loading branch information
1 parent
be5fec5
commit ac49cdd
Showing
20 changed files
with
326 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ on: | |
- release-* | ||
tags-ignore: [ v.* ] | ||
|
||
|
||
jobs: | ||
test: | ||
name: Build and Test | ||
|
@@ -43,6 +42,89 @@ jobs: | |
if: ${{ failure() }} | ||
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \; | ||
|
||
local-test: | ||
name: Integration tests using Testcontainers | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout GitHub merge | ||
if: github.event.pull_request | ||
run: |- | ||
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch | ||
git checkout scratch | ||
- name: Setup Scala with Java ${{ matrix.java-version }} | ||
uses: olafurpg/setup-scala@v13 | ||
with: | ||
java-version: [email protected] | ||
|
||
- name: Cache Coursier cache | ||
uses: coursier/cache-action@v6 | ||
|
||
- name: Run tests | ||
run: sbt "IntegrationTest/testOnly com.lightbend.kafkalagexporter.integration.testcontainers.*" | ||
|
||
- name: Print logs on failure | ||
if: ${{ failure() }} | ||
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \; | ||
|
||
minikube-test: | ||
name: Integration tests using Minikube | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout GitHub merge | ||
if: github.event.pull_request | ||
run: |- | ||
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch | ||
git checkout scratch | ||
- name: Setup Scala with Java ${{ matrix.java-version }} | ||
uses: olafurpg/setup-scala@v13 | ||
with: | ||
java-version: [email protected] | ||
|
||
- name: Cache Coursier cache | ||
uses: coursier/cache-action@v6 | ||
|
||
- name: Start minikube | ||
uses: medyagh/setup-minikube@master | ||
|
||
- name: Setup Minikube | ||
if: github.event.pull_request | ||
run: |- | ||
sbt docker:publishLocal | ||
echo Minikube image loading.. | ||
minikube image load seglo/kafka-lag-exporter:latest | ||
echo Install Strimzi and Kafka cluster.. | ||
helm repo add strimzi https://strimzi.io/charts/ | ||
helm install strimzi strimzi/strimzi-kafka-operator | ||
kubectl apply -f ./examples/k8s/strimzi-kafka-cluster.yaml | ||
kubectl wait kafka/strimzi-kafka-cluster --for=condition=Ready --timeout=300s | ||
echo Running pods.. | ||
kubectl get po -A | ||
- name: Run tests | ||
run: sbt "IntegrationTest/testOnly com.lightbend.kafkalagexporter.integration.minikube.*" | ||
|
||
- name: Print logs on failure | ||
if: ${{ failure() }} | ||
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \; | ||
|
||
build-docker: | ||
name: Build Docker Image | ||
runs-on: ubuntu-18.04 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
clusters: | ||
- name: "default" | ||
bootstrapBrokers: "strimzi-kafka-cluster-kafka-bootstrap.default.svc.cluster.local:9092" | ||
pollIntervalSeconds: 1 | ||
service: | ||
type: NodePort | ||
rootLogLevel: INFO | ||
kafkaLagExporterLogLevel: DEBUG | ||
kafkaLogLevel: INFO | ||
akkaLogLevel: DEBUG | ||
image: | ||
tag: latest | ||
pullPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# coredns doesn't like references to nameservers on local loop back | ||
# fix replaces `forward` with generic config pointing to google dns | ||
# https://github.com/kubernetes/minikube/issues/7512#issuecomment-664348459 | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: coredns | ||
namespace: kube-system | ||
data: | ||
Corefile: | | ||
.:53 { | ||
errors | ||
health { | ||
lameduck 5s | ||
} | ||
ready | ||
kubernetes cluster.local in-addr.arpa ip6.arpa { | ||
pods insecure | ||
fallthrough in-addr.arpa ip6.arpa | ||
ttl 30 | ||
} | ||
prometheus :9153 | ||
hosts { | ||
192.168.49.1 host.minikube.internal | ||
fallthrough | ||
} | ||
cache 30 | ||
loop | ||
reload | ||
loadbalance | ||
forward . 8.8.8.8 8.8.4.4 | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
export SERVICE=$1 | ||
NODE_PORT=$(kubectl get service ${SERVICE} -o=jsonpath='{.spec.ports[0].nodePort}{"\n"}') && | ||
NODE_IP=$(minikube ip) && | ||
echo ${NODE_IP}:${NODE_PORT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
kind: Kafka | ||
metadata: | ||
name: strimzi-kafka-cluster | ||
spec: | ||
kafka: | ||
version: 3.0.0 | ||
replicas: 1 | ||
listeners: | ||
- name: plain | ||
port: 9092 | ||
type: internal | ||
tls: false | ||
- name: tls | ||
port: 9093 | ||
type: internal | ||
tls: true | ||
- name: external | ||
port: 9094 | ||
type: nodeport | ||
tls: false | ||
config: | ||
offsets.topic.replication.factor: 1 | ||
transaction.state.log.replication.factor: 1 | ||
transaction.state.log.min.isr: 1 | ||
default.replication.factor: 1 | ||
min.insync.replicas: 1 | ||
inter.broker.protocol.version: "3.0" | ||
storage: | ||
type: ephemeral | ||
zookeeper: | ||
replicas: 3 | ||
storage: | ||
type: ephemeral | ||
entityOperator: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: kafka.strimzi.io/v1beta2 | ||
kind: KafkaTopic | ||
metadata: | ||
name: my-topic | ||
labels: | ||
strimzi.io/cluster: strimzi-kafka-cluster | ||
spec: | ||
partitions: 1 | ||
replicas: 1 | ||
config: | ||
retention.ms: 7200000 | ||
segment.bytes: 1073741824 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...t/scala/com/lightbend/kafkalagexporter/integration/minikube/MiniKubeIntegrationSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.lightbend.kafkalagexporter.integration.minikube | ||
|
||
import com.lightbend.kafkalagexporter.integration.IntegrationSpec | ||
|
||
import scala.concurrent.duration.DurationInt | ||
|
||
class MiniKubeIntegrationSpec extends MinikubeSpecBase with IntegrationSpec { | ||
override implicit val patience: PatienceConfig = PatienceConfig(90.seconds, 2.second) | ||
} |
Oops, something went wrong.