Skip to content

Commit 3f2780e

Browse files
committed
Cleanup, revert system test Java changes
Signed-off-by: Michael Edgar <medgar@redhat.com>
1 parent 3bf7d98 commit 3f2780e

6 files changed

Lines changed: 64 additions & 84 deletions

File tree

.github/workflows/integration.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,3 @@ jobs:
231231
Playwright:
232232
if: ${{ contains(github.event.pull_request.labels.*.name, 'safe to test') || github.repository == 'streamshub/console' }}
233233
uses: ./.github/workflows/playwright-tests.yml
234-
#needs:
235-
# - build-images

.github/workflows/systemtests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ jobs:
161161
with:
162162
node-version: lts/*
163163
- run: |
164-
npm install -g playwright --ignore-scripts
164+
PLAYWRIGHT_VERSION=$(mvn help:evaluate -f systemtests/pom.xml -Dexpression=playwright.version -q -DforceStdout)
165+
npm install -g playwright@${PLAYWRIGHT_VERSION} --ignore-scripts
165166
npx --ignore-scripts playwright install --with-deps
166167
167168
- name: Build project

systemtests/scripts/setup-minikube.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fi
4646
# Setup OLM -----------------------------------------------------
4747
OLM_INSTALL_SCRIPT=$(mktemp)
4848

49-
curl --proto "=https" --tlsv1.3 -o ${OLM_INSTALL_SCRIPT} -sL \
49+
curl --proto "=https" -o ${OLM_INSTALL_SCRIPT} -sL \
5050
https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh
5151

5252
echo "${OLM_SCRIPT_SHA256} ${OLM_INSTALL_SCRIPT}" | sha256sum --check --status || { echo "Hash verification failed"; exit 1; }

systemtests/src/main/java/com/github/streamshub/systemtests/setup/strimzi/KafkaSetup.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
package com.github.streamshub.systemtests.setup.strimzi;
22

3-
import java.io.File;
4-
import java.util.List;
5-
import java.util.Map;
6-
import java.util.stream.IntStream;
7-
8-
import org.apache.logging.log4j.Logger;
9-
103
import com.github.streamshub.systemtests.Environment;
114
import com.github.streamshub.systemtests.constants.Constants;
125
import com.github.streamshub.systemtests.logs.LogWrapper;
136
import com.github.streamshub.systemtests.utils.Utils;
147
import com.github.streamshub.systemtests.utils.WaitUtils;
158
import com.github.streamshub.systemtests.utils.resourceutils.ClusterUtils;
9+
import com.github.streamshub.systemtests.utils.resourceutils.ResourceUtils;
1610
import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaNamingUtils;
17-
1811
import io.fabric8.kubernetes.api.model.ConfigMap;
1912
import io.fabric8.kubernetes.api.model.ConfigMapBuilder;
2013
import io.skodjob.kubetest4j.resources.KubeResourceManager;
@@ -35,6 +28,12 @@
3528
import io.strimzi.api.kafka.model.user.KafkaUserBuilder;
3629
import io.strimzi.api.kafka.model.user.acl.AclOperation;
3730
import io.strimzi.api.kafka.model.user.acl.AclResourcePatternType;
31+
import org.apache.logging.log4j.Logger;
32+
33+
import java.io.File;
34+
import java.util.List;
35+
import java.util.Map;
36+
import java.util.stream.IntStream;
3837

3938
import static io.skodjob.kubetest4j.KubeTestEnv.USER_PATH;
4039

@@ -84,14 +83,16 @@ public static void setupKafkaWithCcIfNeeded(String namespaceName, String cluster
8483
*/
8584
public static void setupKafkaIfNeeded(ConfigMap configMap, KafkaNodePool brokerNodePools, KafkaNodePool controllerNodePools, KafkaUser kafkaUser, Kafka kafka) {
8685
LOGGER.info("Setup test Kafka {}/{} and it's components", kafka.getMetadata().getNamespace(), kafka.getMetadata().getName());
87-
KubeResourceManager.get().createOrUpdateResourceAsyncWait(
88-
configMap,
89-
brokerNodePools,
90-
controllerNodePools,
91-
kafka,
92-
kafkaUser
93-
);
94-
WaitUtils.waitForSecretReady(kafkaUser.getMetadata().getNamespace(), kafkaUser.getMetadata().getName());
86+
if (ResourceUtils.getKubeResource(Kafka.class, kafka.getMetadata().getNamespace(), kafka.getMetadata().getName()) == null) {
87+
KubeResourceManager.get().createResourceWithWait(configMap);
88+
KubeResourceManager.get().createResourceWithWait(brokerNodePools);
89+
KubeResourceManager.get().createResourceWithWait(controllerNodePools);
90+
KubeResourceManager.get().createResourceWithWait(kafka);
91+
KubeResourceManager.get().createResourceWithWait(kafkaUser);
92+
WaitUtils.waitForSecretReady(kafkaUser.getMetadata().getNamespace(), kafkaUser.getMetadata().getName());
93+
} else {
94+
LOGGER.warn("Skipping Kafka deployment, there already is a Kafka cluster");
95+
}
9596
}
9697

9798
/**

systemtests/src/main/java/com/github/streamshub/systemtests/utils/playwright/PwUtils.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,15 @@ public static Browser createBrowser(Playwright playwright) {
7070
* @param tcc the test case configuration containing page and Kafka cluster information
7171
*/
7272
public static void login(TestCaseConfig tcc, String kafkaName) {
73-
String overviewUrl = PwPageUrls.getOverviewPage(tcc, kafkaName);
74-
LOGGER.info("Logging in to the Console with URL: {}", overviewUrl);
73+
final String loginUrl = PwPageUrls.getKafkaLoginPage(tcc, kafkaName);
74+
LOGGER.info("Logging in to the Console with URL: {}", loginUrl);
75+
waitForConsoleUiAnonymousLoginToBecomeReady(tcc);
7576
// Anonymous login
76-
navigate(tcc, overviewUrl);
77-
waitForUrl(tcc, overviewUrl, true);
77+
navigate(tcc, loginUrl);
78+
waitForUrl(tcc, loginUrl, false);
79+
// Go to login
80+
waitForLocatorAndClick(tcc, CssSelectors.LOGIN_ANONYMOUSLY_BUTTON);
81+
waitForUrl(tcc, PwPageUrls.getOverviewPage(tcc, kafkaName), true);
7882
LOGGER.info("Successfully logged into Console");
7983
}
8084

systemtests/src/test/java/com/github/streamshub/systemtests/messages/MessagesST.java

Lines changed: 36 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
package com.github.streamshub.systemtests.messages;
22

3-
import java.time.Instant;
4-
import java.time.OffsetDateTime;
5-
import java.time.ZoneId;
6-
import java.time.ZoneOffset;
7-
import java.time.format.DateTimeFormatter;
8-
import java.util.Map;
9-
import java.util.stream.Stream;
10-
11-
import org.apache.kafka.common.security.auth.SecurityProtocol;
12-
import org.apache.logging.log4j.Logger;
13-
import org.junit.jupiter.api.AfterAll;
14-
import org.junit.jupiter.api.BeforeAll;
15-
import org.junit.jupiter.api.Tag;
16-
import org.junit.jupiter.api.Test;
17-
import org.junit.jupiter.params.ParameterizedTest;
18-
import org.junit.jupiter.params.provider.Arguments;
19-
import org.junit.jupiter.params.provider.MethodSource;
20-
213
import com.github.streamshub.systemtests.AbstractST;
224
import com.github.streamshub.systemtests.MessageStore;
235
import com.github.streamshub.systemtests.TestCaseConfig;
@@ -42,12 +24,24 @@
4224
import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaTopicUtils;
4325
import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaUtils;
4426
import com.github.streamshub.systemtests.utils.testchecks.MessagesChecks;
45-
import com.microsoft.playwright.Page.GetByRoleOptions;
46-
import com.microsoft.playwright.assertions.LocatorAssertions.ContainsTextOptions;
47-
import com.microsoft.playwright.assertions.PlaywrightAssertions;
48-
import com.microsoft.playwright.options.AriaRole;
49-
5027
import io.skodjob.kubetest4j.resources.KubeResourceManager;
28+
import org.apache.kafka.common.security.auth.SecurityProtocol;
29+
import org.apache.logging.log4j.Logger;
30+
import org.junit.jupiter.api.AfterAll;
31+
import org.junit.jupiter.api.BeforeAll;
32+
import org.junit.jupiter.api.Tag;
33+
import org.junit.jupiter.api.Test;
34+
import org.junit.jupiter.params.ParameterizedTest;
35+
import org.junit.jupiter.params.provider.Arguments;
36+
import org.junit.jupiter.params.provider.MethodSource;
37+
38+
import java.time.Instant;
39+
import java.time.OffsetDateTime;
40+
import java.time.ZoneId;
41+
import java.time.ZoneOffset;
42+
import java.time.format.DateTimeFormatter;
43+
import java.util.Map;
44+
import java.util.stream.Stream;
5145

5246
import static com.github.streamshub.systemtests.utils.Utils.getTestCaseConfig;
5347
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -325,12 +319,8 @@ void testFilterMessagesUsingUIForm() {
325319
PwUtils.navigate(tcc, PwPageUrls.getMessagesPage(tcc, tcc.kafkaName(), topicId));
326320

327321
LOGGER.info("Wait for page toolbar to be fully loaded before filtering");
328-
PlaywrightAssertions.assertThat(tcc.page().getByRole(AriaRole.HEADING, new GetByRoleOptions().setLevel(1)))
329-
.containsText(kafkaTopicName, new ContainsTextOptions().setTimeout(20000));
330-
PlaywrightAssertions.assertThat(tcc.page().getByPlaceholder("Search")).isVisible();
331-
332-
//PwUtils.waitForContainsText(tcc, CssSelectors.PAGES_CONTENT_HEADER_TITLE_CONTENT, kafkaTopicName, true);
333-
//PwUtils.waitForLocatorVisible(tcc, MessagesPageSelectors.MPS_SEARCH_TOOLBAR_QUERY_INPUT);
322+
PwUtils.waitForContainsText(tcc, CssSelectors.PAGES_CONTENT_HEADER_TITLE_CONTENT, kafkaTopicName, true);
323+
PwUtils.waitForLocatorVisible(tcc, MessagesPageSelectors.MPS_SEARCH_TOOLBAR_QUERY_INPUT);
334324

335325
LOGGER.info("Verify default state of displayed messages");
336326
PwUtils.waitForLocatorCount(tcc, 50, MessagesPageSelectors.MPS_SEARCH_RESULTS_TABLE_ITEMS, true);
@@ -455,51 +445,37 @@ public void prepareVariousMessageTypes() {
455445

456446
// Setup UI form filtering
457447
// First set clients to send messages with KEY
458-
KafkaClients clients1 = new KafkaClientsBuilder()
448+
KafkaClients clients = new KafkaClientsBuilder()
459449
.withNamespaceName(tcc.namespace())
460450
.withTopicName(kafkaTopicName)
461451
.withMessageCount(MESSAGE_COUNT)
462452
.withDelayMs(0)
463-
.withProducerName(KafkaNamingUtils.producerName(kafkaTopicName) + "-1")
464-
.withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName) + "-1")
465-
.withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName) + "-1")
453+
.withProducerName(KafkaNamingUtils.producerName(kafkaTopicName))
454+
.withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName))
455+
.withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName))
466456
.withBootstrapAddress(KafkaUtils.getPlainScramShaBootstrapAddress(tcc.kafkaName()))
467457
.withUsername(tcc.kafkaUserName())
468458
.withMessage(KEY_FILTER_MESSAGE)
469459
.withMessageKey(KEY_FILTER)
470460
.withAdditionalConfig(KafkaClientsUtils.getScramShaConfig(tcc.namespace(), tcc.kafkaUserName(), SecurityProtocol.SASL_PLAINTEXT))
471461
.build();
472462

463+
KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer());
464+
WaitUtils.waitForClientsSuccess(clients);
465+
473466
// create second set of messages with different HEADER and MESSAGE
474-
KafkaClients clients2 = new KafkaClientsBuilder(clients1)
475-
.withProducerName(KafkaNamingUtils.producerName(kafkaTopicName) + "-2")
476-
.withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName) + "-2")
477-
.withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName) + "-2")
478-
.withMessageKey("NoDataInKey-True")
479-
.withHeaders(HEADER_FILTER)
480-
.withMessage(HEADER_FILTER_MESSAGE)
481-
.build();
467+
clients.setMessageKey("NoDataInKey-True");
468+
clients.setHeaders(HEADER_FILTER);
469+
clients.setMessage(HEADER_FILTER_MESSAGE);
482470

471+
KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer());
472+
WaitUtils.waitForClientsSuccess(clients);
483473
// create third set of messages with different MESSAGE
484-
KafkaClients clients3 = new KafkaClientsBuilder(clients2)
485-
.withProducerName(KafkaNamingUtils.producerName(kafkaTopicName) + "-3")
486-
.withConsumerName(KafkaNamingUtils.consumerName(kafkaTopicName) + "-3")
487-
.withConsumerGroup(KafkaNamingUtils.consumerGroupName(kafkaTopicName) + "-3")
488-
.withHeaders("NoDataInHeader=true")
489-
.withMessage(VALUE_FILTER)
490-
.build();
491-
492-
KubeResourceManager.get().createOrUpdateResourceAsyncWait(
493-
clients1.producer(),
494-
clients1.consumer(),
495-
clients2.producer(),
496-
clients2.consumer(),
497-
clients3.producer(),
498-
clients3.consumer()
499-
);
500-
WaitUtils.waitForClientsSuccess(clients1);
501-
WaitUtils.waitForClientsSuccess(clients2);
502-
WaitUtils.waitForClientsSuccess(clients3);
474+
clients.setHeaders("NoDataInHeader=true");
475+
clients.setMessage(VALUE_FILTER);
476+
477+
KubeResourceManager.get().createResourceWithWait(clients.producer(), clients.consumer());
478+
WaitUtils.waitForClientsSuccess(clients);
503479
LOGGER.info("Filtering scenario prepared");
504480
}
505481

0 commit comments

Comments
 (0)