Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TopologyTestDriver does not pick up serde defaults #31887

Open
msillence opened this issue Mar 16, 2023 · 2 comments
Open

TopologyTestDriver does not pick up serde defaults #31887

msillence opened this issue Mar 16, 2023 · 2 comments
Labels

Comments

@msillence
Copy link
Contributor

Description

In my application.properties I have:

quarkus.kafka-streams.schema-registry-url=${kafka.schema.registry.url}
quarkus.kafka-streams.default.key.serde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
quarkus.kafka-streams.default.value.serde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde

in my application-test.properties I have:

quarkus.apicurio-registry.devservices.port=18081

kafka.schema.registry.url=http://localhost:18081/apis/ccompat/v6
schema.registry.url=${kafka.schema.registry.url}

new TopologyTestDriver(topology) - does not pick these up instead I need to manually create the properties and pass them in:

   @ConfigProperty(name="quarkus.kafka-streams.default.key.serde")
   String keySerde;

   @ConfigProperty(name="quarkus.kafka-streams.default.value.serde")
   String valueSerde;

   @ConfigProperty(name="schema.registry.url")
   String schemaRegistry;   

   @Test
   public void myTest() {

	   // using DSL
	   StreamsBuilder builder = new StreamsBuilder();
	  .... build thing to test
	   Topology topology = builder.build();

	   // create test driver
	   Properties p = new Properties();
	   p.setProperty(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, keySerde);
	   p.setProperty(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, valueSerde);
	   p.setProperty("schema.registry.url", schemaRegistry);

	   try (TopologyTestDriver testDriver = new TopologyTestDriver(topology, p)) {

### Implementation ideas

It would be great if it could pick up the same properties I use to configure the app and I didn't have manually add in the right mappings.

i.e.

quarkus.kafka-streams.schema-registry-url
quarkus.kafka-streams.default.key.serde
quarkus.kafka-streams.default.value.serde

@geoand
Copy link
Contributor

geoand commented Mar 20, 2023

Maybe there could be TopologyTestDriverResource QuarkusTestResource that would create a TopologyTestDriver bean.

Sounds reasonable to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants