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

[FLINK-28177] for test containers add elasticsearch service really up check #48

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,20 @@
import static org.apache.flink.streaming.connectors.elasticsearch.table.TestContext.context;
import static org.apache.flink.table.api.Expressions.row;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testcontainers.containers.wait.strategy.Wait.forHttp;

/** IT tests for {@link Elasticsearch6DynamicSink}. */
public class Elasticsearch6DynamicSinkITCase extends TestLogger {

@ClassRule
public static ElasticsearchContainer elasticsearchContainer =
new ElasticsearchContainer(DockerImageName.parse(DockerImageVersions.ELASTICSEARCH_6));
new ElasticsearchContainer(DockerImageName.parse(DockerImageVersions.ELASTICSEARCH_6))
.waitingFor(
forHttp("/")
.withMethod("HEAD")
.forStatusCode(200)
.forPort(9200)
.withStartupTimeout(Duration.ofMinutes(2)));

@SuppressWarnings("deprecation")
protected final RestHighLevelClient getClient() {
Expand Down Expand Up @@ -230,11 +237,8 @@ public void testWritingDocumentsFromTableApi() throws Exception {

@Test
public void testWritingDocumentsNoPrimaryKey() throws Exception {
EnvironmentSettings settings = EnvironmentSettings.inStreamingMode();
settings.getConfiguration().setString("restart-strategy", "fixed-delay");
settings.getConfiguration().setInteger("restart-strategy.fixed-delay.attempts", 3);
// default fixed delay is 1 seconds
TableEnvironment tableEnvironment = TableEnvironment.create(settings);
TableEnvironment tableEnvironment =
TableEnvironment.create(EnvironmentSettings.inStreamingMode());

String index = "no-primary-key";
String myType = "MyType";
Expand Down