Restore the option to run Kafka tests embedded vs. external

Honour the `SCS_KAFKA_TEST_EMBEDDED` flag when set as an environment variable
or Java property: when explicitly set to `false`, use an external broker and observe the
`SCS_EXTERNAL_SERVERS_REQUIRED` property (i.e. fail if server is missing). By default,
continue to run tests using an embedded broker.
This commit is contained in:
Marius Bogoevici
2016-05-10 09:12:34 -04:00
parent 9668cb968f
commit b579ddbcc5
3 changed files with 4 additions and 3 deletions

View File

@@ -84,7 +84,7 @@ public class KafkaBinderTests extends PartitionCapableBinderTests<KafkaTestBinde
private final String CLASS_UNDER_TEST_NAME = KafkaMessageChannelBinder.class.getSimpleName();
@ClassRule
public static KafkaTestSupport kafkaTestSupport = new KafkaTestSupport(true);
public static KafkaTestSupport kafkaTestSupport = new KafkaTestSupport();
private KafkaTestBinder binder;

View File

@@ -194,7 +194,6 @@ public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends
if (testBinder != null) {
testBinder.cleanup();
}
System.clearProperty("SCS_KAFKA_TEST_EMBEDDED");
}
/**

View File

@@ -70,7 +70,9 @@ public class KafkaTestSupport extends AbstractExternalResourceTestSupport<String
static {
// check if either the environment or Java property is set to use embedded tests
defaultEmbedded = "true".equals(System.getenv(SCS_KAFKA_TEST_EMBEDDED)) || "true".equals(System.getProperty(SCS_KAFKA_TEST_EMBEDDED));
// unless the property is explicitly set to false, default to embedded
defaultEmbedded = !("false".equals(System.getenv(SCS_KAFKA_TEST_EMBEDDED))
|| "false".equals(System.getProperty(SCS_KAFKA_TEST_EMBEDDED)));
}
public KafkaTestSupport() {