Skip to content

Commit

Permalink
Fix non-determinism in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannedolan committed Dec 8, 2024
1 parent 97f6b8f commit a60510e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 33 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build:
bounce: build undeploy deploy deploy-samples deploy-config deploy-demo

# Integration tests expect K8s and Kafka to be running
integration-tests:
integration-tests: deploy-samples
kubectl port-forward -n kafka svc/one-kafka-external-0 9092 & echo $$! > port-forward.pid
./gradlew intTest || kill `cat port-forward.pid`
kill `cat port-forward.pid`
Expand Down Expand Up @@ -44,7 +44,11 @@ deploy-samples: deploy
kubectl wait --for=condition=Established=True \
crds/subscriptions.hoptimator.linkedin.com \
crds/kafkatopics.hoptimator.linkedin.com \
crds/sqljobs.hoptimator.linkedin.com
crds/databases.hoptimator.linkedin.com \
crds/views.hoptimator.linkedin.com \
crds/pipelines.hoptimator.linkedin.com \
crds/tabletemplates.hoptimator.linkedin.com \
crds/jobtemplates.hoptimator.linkedin.com
kubectl apply -f ./deploy/samples

deploy-config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void execute(Context context, boolean execute) throws Exception {
CalciteConnection conn = (CalciteConnection) context.connection();
RelNode rel = HoptimatorDriver.convert(conn.createPrepareContext(), sql).root.rel;
String specs = DeploymentService.plan(rel).pipeline().specify().stream()
.collect(Collectors.joining("---\n"));
.sorted().collect(Collectors.joining("---\n"));
String[] lines = specs.replaceAll(";\n","\n").split("\n");
context.echo(Arrays.asList(lines));
} else {
Expand Down
60 changes: 30 additions & 30 deletions hoptimator-kafka/src/test/resources/kafka-ddl.id
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,6 @@
!use k8s

insert into kafka."existing-topic-1" select * from kafka."existing-topic-2";
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: kafka-database-existing-topic-2
namespace: kafka
labels:
strimzi.io/cluster: one
spec:
topicName: existing-topic-2
partitions: 1
replicas: 1
config:
retention.ms: 7200000
segment.bytes: 1073741824
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: kafka-database-existing-topic-1
namespace: kafka
labels:
strimzi.io/cluster: one
spec:
topicName: existing-topic-1
partitions: 1
replicas: 1
config:
retention.ms: 7200000
segment.bytes: 1073741824
---
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
Expand Down Expand Up @@ -61,4 +31,34 @@ spec:
parallelism: 1
upgradeMode: stateless
state: running
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: kafka-database-existing-topic-1
namespace: kafka
labels:
strimzi.io/cluster: one
spec:
topicName: existing-topic-1
partitions: 1
replicas: 1
config:
retention.ms: 7200000
segment.bytes: 1073741824
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: kafka-database-existing-topic-2
namespace: kafka
labels:
strimzi.io/cluster: one
spec:
topicName: existing-topic-2
partitions: 1
replicas: 1
config:
retention.ms: 7200000
segment.bytes: 1073741824
!specify

0 comments on commit a60510e

Please sign in to comment.