Skip to content

Commit

Permalink
chore: remove flaky test for TERMINATE CST queries (#8089)
Browse files Browse the repository at this point in the history
  • Loading branch information
spena committed Sep 1, 2021
1 parent abacbca commit ccb8936
Showing 1 changed file with 1 addition and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
package io.confluent.ksql.rest.integration;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.fail;

import io.confluent.common.utils.IntegrationTest;
import io.confluent.ksql.integration.IntegrationTestHarness;
Expand All @@ -33,7 +31,6 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import io.confluent.ksql.util.UserDataProvider;
import kafka.zookeeper.ZooKeeperClientException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
Expand All @@ -50,14 +47,9 @@
public class TerminateTransientQueryFunctionalTest {

private static final PageViewDataProvider PAGE_VIEWS_PROVIDER = new PageViewDataProvider();
private static final UserDataProvider USER_DATA_PROVIDER = new UserDataProvider();

private static final String PAGE_VIEW_TOPIC = PAGE_VIEWS_PROVIDER.topicName();
private static final String PAGE_VIEW_STREAM = PAGE_VIEWS_PROVIDER.sourceName();

private static final String USER_TOPIC = USER_DATA_PROVIDER.topicName();
private static final String USER_TABLE = USER_DATA_PROVIDER.sourceName();

private static final IntegrationTestHarness TEST_HARNESS = IntegrationTestHarness.build();
private static final TestKsqlRestApp REST_APP_0 = TestKsqlRestApp
.builder(TEST_HARNESS::kafkaBootstrapServers)
Expand All @@ -82,9 +74,8 @@ public class TerminateTransientQueryFunctionalTest {
.around(REST_APP_1);
@BeforeClass
public static void setUpClass() {
TEST_HARNESS.ensureTopics(PAGE_VIEW_TOPIC, USER_TOPIC);
TEST_HARNESS.ensureTopics(PAGE_VIEW_TOPIC);
RestIntegrationTestUtil.createStream(REST_APP_0, PAGE_VIEWS_PROVIDER);
RestIntegrationTestUtil.createTable(REST_APP_0, USER_DATA_PROVIDER, true);
RestIntegrationTestUtil.makeKsqlRequest(
REST_APP_0,
"CREATE STREAM S AS SELECT * FROM " + PAGE_VIEW_STREAM + ";"
Expand All @@ -101,30 +92,6 @@ public static void tearDownClass() {
service.shutdownNow();
}

@Test
public void shouldFailOnTerminateSourceTableQuery() {
// Given
final String persistentQueryId = getPersistentQueryIds()
.stream()
.filter(n -> n.contains("CST_" + USER_TABLE))
.collect(Collectors.toList())
.get(0);

// When:
try {
RestIntegrationTestUtil.makeKsqlRequest(
REST_APP_0,
"terminate " + persistentQueryId + ";"
);

fail("CST queries cannot be terminated manually.");
} catch (final AssertionError e) {
// Then:
assertThat(e.getMessage(), containsString("Cannot terminate query " +
"'" + persistentQueryId + "' because it is linked to a source table."));
}
}

@Test
public void shouldTerminatePushQueryOnSameNode() {
// Given:
Expand Down Expand Up @@ -182,13 +149,6 @@ public List<String> getTransientQueryIds () {
.collect(Collectors.toList());
}

public List<String> getPersistentQueryIds () {
return showQueries().stream()
.filter(q -> !q.getId().toString().contains("transient"))
.map(q -> q.getId().toString())
.collect(Collectors.toList());
}

public void givenPushQuery() {
service.execute(backgroundTask);

Expand Down

0 comments on commit ccb8936

Please sign in to comment.