Skip to content

Commit

Permalink
Fix memory problems inside test suite (#99)
Browse files Browse the repository at this point in the history
* Fix memory problems inside test suite

Signed-off-by: see-quick <[email protected]>

* add after each

Signed-off-by: see-quick <[email protected]>

* also for KafkaContainerIT

Signed-off-by: see-quick <[email protected]>

---------

Signed-off-by: see-quick <[email protected]>
  • Loading branch information
see-quick authored Nov 4, 2024
1 parent 2d550b3 commit 546f9e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
Expand Down Expand Up @@ -312,6 +313,7 @@ void testGetProxyWithNoContainer(final String imageName) {
.waitForRunning();
systemUnderTest.start();
assertThrows(IllegalStateException.class, () -> systemUnderTest.getProxy());
systemUnderTest.stop();
}

@Test
Expand Down Expand Up @@ -377,4 +379,11 @@ void testKafkaContainerFunctionality() {
}
}
}

@AfterEach
void afterEach() {
if (this.systemUnderTest != null) {
this.systemUnderTest.stop();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -172,4 +173,11 @@ private void verify() throws InterruptedException, ExecutionException, TimeoutEx
assertThat(records.records(topic).get(2).value(), equalTo("3"));
}
}

@AfterEach
void afterEach() {
if (this.systemUnderTest != null) {
this.systemUnderTest.stop();
}
}
}

0 comments on commit 546f9e6

Please sign in to comment.