Cleanup
This commit is contained in:
@@ -17,20 +17,19 @@ The tests use following patterns:
|
||||
== Source
|
||||
To test a source, we may require some application specific setup or event to trigger the source.
|
||||
For example, the jdbc source needs some data in the database to which it is listening.
|
||||
Then use an `outputPayloadVerifier` or `outputMessageVerifier` to verify the output.
|
||||
Then use an `OutputMatcher` to verify the output.
|
||||
|
||||
== Sink
|
||||
To test a sink, we need to publish a message to its input. Simply use the provided KafkaTemplate or RabbitTemplate beans.
|
||||
To test a sink, we need to publish a message to its input. Simply use the provided TestTopicSender.
|
||||
Then we need to verify the result by checking the sink's external resource.
|
||||
|
||||
== Processor
|
||||
To test a processor we publish a message and use an `outputPayloadVerifier` or `outputMessageVerifier` to verify the output.
|
||||
To test a processor we publish a message and use an `OutputMatcher` to verify the output.
|
||||
|
||||
== Configuration
|
||||
See link:src/test/java/org/springframework/cloud/stream/apps/integration/test/common/Configuration.java[Configuration] for configuration
|
||||
options. These tests use Spring but not boot currently.
|
||||
The most important setting is the image versions to test.
|
||||
By default, we use `latest`.
|
||||
To override it, set the System property, e.g.,
|
||||
|
||||
./mvnw clean test -Dspring.cloud.stream.applications.version=3.0.0-M3
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientCacheFactory;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -42,7 +41,6 @@ import org.springframework.cloud.stream.app.test.integration.OutputMatcher;
|
||||
import org.springframework.cloud.stream.app.test.integration.StreamAppContainer;
|
||||
import org.springframework.cloud.stream.app.test.integration.StreamAppContainerTestUtils;
|
||||
import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQStreamAppContainer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.springframework.cloud.stream.apps.integration.test.common.Configuration.DEFAULT_DURATION;
|
||||
@@ -63,9 +61,6 @@ public abstract class GeodeSourceTests {
|
||||
@Autowired
|
||||
private OutputMatcher outputMatcher;
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext context;
|
||||
|
||||
@Container
|
||||
private static final GeodeContainer geode = (GeodeContainer) new GeodeContainer(new ImageFromDockerfile()
|
||||
.withFileFromClasspath("Dockerfile", "geode/Dockerfile")
|
||||
@@ -107,32 +102,20 @@ public abstract class GeodeSourceTests {
|
||||
@Test
|
||||
void test() throws InterruptedException {
|
||||
await().atMost(Duration.ofMinutes(2)).until(logMatcher.matches());
|
||||
if (source instanceof RabbitMQStreamAppContainer) {
|
||||
// TODO: Some race condition. Need to investigate
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
String random = UUID.randomUUID().toString();
|
||||
|
||||
clientRegion.put(random, random);
|
||||
|
||||
if (source instanceof RabbitMQStreamAppContainer) {
|
||||
// Thread.sleep(30);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
await().atMost(Duration.ofSeconds(30))
|
||||
.until(outputMatcher.payloadMatches((String s) -> {
|
||||
System.out.println("!!!!!!!!!!!!!Matching on " + s);
|
||||
return s.contains(random);
|
||||
}));
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void clear() {
|
||||
.until(outputMatcher.payloadMatches((String s) -> s.contains(random)));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void cleanup() {
|
||||
source.stop();
|
||||
clientCache.close();
|
||||
geode.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.cloud.stream.apps.integration.test.source.geode;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
||||
import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQConfig;
|
||||
import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQStreamAppTest;
|
||||
@@ -25,7 +24,6 @@ import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQSt
|
||||
import static org.springframework.cloud.stream.apps.integration.test.common.Configuration.VERSION;
|
||||
|
||||
@RabbitMQStreamAppTest
|
||||
@Disabled("Some race condition when package tests run together")
|
||||
class RabbitMQGeodeSourceTests extends GeodeSourceTests {
|
||||
|
||||
@BeforeAll
|
||||
|
||||
Reference in New Issue
Block a user