diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 7caeb3625..4c4a7dcbf 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -16,19 +16,20 @@ jobs: with: fetch-depth: 0 - - name: Ensure upgrade YAMLs changed + - name: Ensure old operator version was bumped run: | - CHANGED=$(git diff --name-only \ + CHANGED=$(git diff \ ${{ github.event.pull_request.base.sha }} \ ${{ github.event.pull_request.head.sha }} \ - | grep -E "systemtests/src/test/resources/upgrade/(YamlUpgrade.yaml)" || true) + -- systemtests/src/main/java/com/github/streamshub/systemtests/Environment.java \ + | grep -E "^[+-].*OLD_CONSOLE_OPERATOR_VERSION" || true) if [ -z "$CHANGED" ]; then - echo "❌[ERROR]: YamlUpgrade.yaml was not modified in this PR, exiting the flow." + echo "❌[ERROR]: OLD_CONSOLE_OPERATOR_VERSION in Environment.java was not modified in this PR, exiting the flow." exit 1 fi - echo "✔️ Upgrade YAML change detected: $CHANGED" + echo "✔️ OLD_CONSOLE_OPERATOR_VERSION change detected: $CHANGED" - name: Retrieve Project Metadata uses: smallrye/project-metadata-action@62527b4a896343d4c0c6b2a61eff07f6b59fcbd8 diff --git a/systemtests/src/main/java/com/github/streamshub/systemtests/Environment.java b/systemtests/src/main/java/com/github/streamshub/systemtests/Environment.java index 6ba58bbef..3c91f5412 100644 --- a/systemtests/src/main/java/com/github/streamshub/systemtests/Environment.java +++ b/systemtests/src/main/java/com/github/streamshub/systemtests/Environment.java @@ -3,6 +3,8 @@ import java.io.IOException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.Optional; +import java.util.function.Predicate; import org.apache.logging.log4j.Logger; @@ -41,6 +43,11 @@ public class Environment { // YAML bundle public static final String CONSOLE_OPERATOR_BUNDLE_URL = ENVS.getOrDefault("CONSOLE_OPERATOR_BUNDLE_URL", ""); + public static final String OLD_CONSOLE_OPERATOR_VERSION = ENVS.getOrDefault("OLD_CONSOLE_OPERATOR_VERSION", "0.13.0"); + public static final String OLD_CONSOLE_OPERATOR_CRDS_URL = ENVS.getOrDefault("OLD_CONSOLE_OPERATOR_CRDS_URL", + "https://github.com/streamshub/console/releases/download/" + OLD_CONSOLE_OPERATOR_VERSION + "/streamshub-console-operator.yaml"); + public static final String NEW_CONSOLE_OPERATOR_CRDS_URL = ENVS.getOrDefault("NEW_CONSOLE_OPERATOR_CRDS_URL", ""); + // OLM public static final String CONSOLE_OLM_CATALOG_SOURCE_NAME = ENVS.getOrDefault("CONSOLE_OLM_CATALOG_SOURCE_NAME", "streamshub-console-catalog"); public static final String CONSOLE_OLM_PACKAGE_NAME = ENVS.getOrDefault("CONSOLE_OLM_PACKAGE_NAME", "streamshub-console-operator"); @@ -113,6 +120,19 @@ public static boolean isOlmInstall() { return CONSOLE_INSTALL_TYPE.equals(InstallType.Olm); } + /** + * Resolves the Console Operator version under test: {@link #CONSOLE_OPERATOR_VERSION} if set, + * otherwise the {@code operator.version} system property (populated by the Maven build with + * the current {@code project.version} — see systemtests/pom.xml). Empty if neither is set. + * Not lowercased: must match the case used in the Quarkus-generated Kubernetes manifest's + * {@code app.kubernetes.io/version} label. + */ + public static String getConsoleOperatorVersion() { + return Optional.of(CONSOLE_OPERATOR_VERSION) + .filter(Predicate.not(String::isBlank)) + .orElseGet(() -> System.getProperty("operator.version", "")); + } + public static boolean isTestClientsPullSecretPresent() { return !Environment.TEST_CLIENTS_PULL_SECRET.isEmpty(); } diff --git a/systemtests/src/main/java/com/github/streamshub/systemtests/setup/console/OlmConfig.java b/systemtests/src/main/java/com/github/streamshub/systemtests/setup/console/OlmConfig.java index 3c4b0e6ce..1afb997e9 100644 --- a/systemtests/src/main/java/com/github/streamshub/systemtests/setup/console/OlmConfig.java +++ b/systemtests/src/main/java/com/github/streamshub/systemtests/setup/console/OlmConfig.java @@ -3,7 +3,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; @@ -121,10 +120,7 @@ public void delete() { public OlmVersionModificationData getUpgradeData() { maybeCreateCatalogSource(); - String newVersion = Optional.of(Environment.CONSOLE_OPERATOR_VERSION) - .filter(Predicate.not(String::isBlank)) - .orElseGet(() -> System.getProperty("operator.version", "") - .toLowerCase(Locale.ROOT)); + String newVersion = Environment.getConsoleOperatorVersion(); String[] newVersionElements = newVersion.split("[.-]"); var newChannelSemVer = Version.of( diff --git a/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/VersionModificationDataLoader.java b/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/VersionModificationDataLoader.java index a1be6a56e..56ae6db6d 100644 --- a/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/VersionModificationDataLoader.java +++ b/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/VersionModificationDataLoader.java @@ -1,13 +1,19 @@ package com.github.streamshub.systemtests.upgrade; -import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import com.github.streamshub.systemtests.Environment; +import com.github.streamshub.systemtests.exceptions.SetupException; +import com.github.streamshub.systemtests.utils.FileUtils; public class VersionModificationDataLoader { public enum InstallType { @@ -15,8 +21,13 @@ public enum InstallType { } private static final Logger LOGGER = LogManager.getLogger(VersionModificationDataLoader.class); - private static final String UPGRADE_FILE_PATH = System.getProperty("user.dir") + "/src/test/resources/upgrade/"; - private static final String YAML_UPGRADE_FILE = UPGRADE_FILE_PATH + "YamlUpgrade.yaml"; + + // Output produced by a normal build in .github/workflows/release.yml, which joins the same two files into release operator YAML bundle. + private static final String OPERATOR_KUBERNETES_DIR = System.getProperty("user.dir") + "/../operator/target/kubernetes/"; + private static final Path OPERATOR_CRD_FILE = Paths.get(OPERATOR_KUBERNETES_DIR, "consoles.console.streamshub.github.com-v1.yml"); + private static final Path OPERATOR_RESOURCES_FILE = Paths.get(OPERATOR_KUBERNETES_DIR, "kubernetes.yml"); + + private static final Pattern VERSION_LABEL_PATTERN = Pattern.compile("app\\.kubernetes\\.io/version:\\s*\"?([\\w.-]+)\"?"); private YamlVersionModificationData yamlUpgradeData; @@ -28,16 +39,59 @@ public VersionModificationDataLoader(InstallType upgradeType) { } private void loadYamlUpgradeData() { - LOGGER.info("Loading Yaml upgrade data from file {}", YAML_UPGRADE_FILE); + String oldOperatorVersion = Environment.OLD_CONSOLE_OPERATOR_VERSION; + String oldOperatorCrdsUrl = Environment.OLD_CONSOLE_OPERATOR_CRDS_URL; + String newOperatorVersion = Environment.getConsoleOperatorVersion(); + String newOperatorCrdsUrl = resolveNewOperatorCrdsUrl(newOperatorVersion); + + this.yamlUpgradeData = new YamlVersionModificationData(oldOperatorVersion, newOperatorVersion, oldOperatorCrdsUrl, newOperatorCrdsUrl); + LOGGER.info("Loaded Yaml upgrade data: operator version {} -> {}", oldOperatorVersion, newOperatorVersion); + } + + static String resolveNewOperatorCrdsUrl(String newOperatorVersion) { + if (Environment.NEW_CONSOLE_OPERATOR_CRDS_URL != null && !Environment.NEW_CONSOLE_OPERATOR_CRDS_URL.isBlank()) { + LOGGER.info("Using NEW_CONSOLE_OPERATOR_CRDS_URL override: {}", Environment.NEW_CONSOLE_OPERATOR_CRDS_URL); + return Environment.NEW_CONSOLE_OPERATOR_CRDS_URL; + } + + String mergedPath = mergeLocalOperatorBundle(newOperatorVersion); + LOGGER.info("NEW_CONSOLE_OPERATOR_CRDS_URL not set, using locally merged operator manifest: {}", mergedPath); + return mergedPath; + } + + private static String mergeLocalOperatorBundle(String newOperatorVersion) { + if (Files.notExists(OPERATOR_CRD_FILE) || Files.notExists(OPERATOR_RESOURCES_FILE)) { + throw new SetupException(String.format("Local Console Operator build output not found at '%s' and '%s. " + + "Build the operator module first before running tests.", OPERATOR_CRD_FILE, OPERATOR_RESOURCES_FILE)); + } + + String actualVersion; + Path mergedBundle; try { - ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); - this.yamlUpgradeData = mapper.readValue(new File(YAML_UPGRADE_FILE), YamlVersionModificationData.class); - LOGGER.info("Loaded Yaml upgrade data: operator version {} -> {}", - yamlUpgradeData.getOldOperatorVersion(), yamlUpgradeData.getNewOperatorVersion()); + actualVersion = extractOperatorVersionLabel(Files.readString(OPERATOR_RESOURCES_FILE)); + mergedBundle = FileUtils.mergeYamlFiles(List.of(OPERATOR_CRD_FILE, OPERATOR_RESOURCES_FILE)); } catch (IOException e) { - LOGGER.error("Failed to parse Yaml upgrade data from file {}: {}", YAML_UPGRADE_FILE, e.getMessage()); - throw new RuntimeException(e); + throw new SetupException("Failed to read/merge local Console Operator build output", e); + } + + if (!newOperatorVersion.equals(actualVersion)) { + throw new SetupException(String.format("Local Console Operator build output at '%s' has version '%s' " + + "but the expected new operator version is '%s'. Rebuild the operator module for the expected version.", + OPERATOR_RESOURCES_FILE, actualVersion, newOperatorVersion)); + } + + return mergedBundle.toAbsolutePath().toString(); + } + + /** + * Extracts the value of the first {@code app.kubernetes.io/version} label found in the given YAML + */ + static String extractOperatorVersionLabel(String yamlContent) { + Matcher matcher = VERSION_LABEL_PATTERN.matcher(yamlContent); + if (!matcher.find()) { + throw new SetupException("Could not find an 'app.kubernetes.io/version' label in the locally built Console Operator YAML bundle"); } + return matcher.group(1); } public YamlVersionModificationData getYamlUpgradeData() { diff --git a/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/YamlVersionModificationData.java b/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/YamlVersionModificationData.java index c4c18e8fd..2a2b76d6b 100644 --- a/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/YamlVersionModificationData.java +++ b/systemtests/src/main/java/com/github/streamshub/systemtests/upgrade/YamlVersionModificationData.java @@ -1,10 +1,17 @@ package com.github.streamshub.systemtests.upgrade; public class YamlVersionModificationData { - private String oldOperatorVersion; - private String newOperatorVersion; - private String oldOperatorCrdsUrl; - private String newOperatorCrdsUrl; + private final String oldOperatorVersion; + private final String newOperatorVersion; + private final String oldOperatorCrdsUrl; + private final String newOperatorCrdsUrl; + + public YamlVersionModificationData(String oldOperatorVersion, String newOperatorVersion, String oldOperatorCrdsUrl, String newOperatorCrdsUrl) { + this.oldOperatorVersion = oldOperatorVersion; + this.newOperatorVersion = newOperatorVersion; + this.oldOperatorCrdsUrl = oldOperatorCrdsUrl; + this.newOperatorCrdsUrl = newOperatorCrdsUrl; + } public String getOldOperatorVersion() { return oldOperatorVersion; diff --git a/systemtests/src/main/java/com/github/streamshub/systemtests/utils/FileUtils.java b/systemtests/src/main/java/com/github/streamshub/systemtests/utils/FileUtils.java index 13ba91570..74ed86ffd 100644 --- a/systemtests/src/main/java/com/github/streamshub/systemtests/utils/FileUtils.java +++ b/systemtests/src/main/java/com/github/streamshub/systemtests/utils/FileUtils.java @@ -182,5 +182,29 @@ public static InputStream loadYamlsFromPath(Path targetPath) throws IOException return new ByteArrayInputStream(combined.toByteArray()); } + + /** + * Concatenates the given files' raw contents, in order, into a single new temporary file — + * equivalent to {@code cat file1 file2 > merged}. Unlike {@link #loadYamlsFromPath(Path)}, this + * does not insert `---` separators between files, since the inputs (e.g. generated Kubernetes + * manifests) already contain their own document separators where needed. + * + * @param files ordered list of files to concatenate + * @return path to the merged temporary file + * @throws IOException if a file cannot be read or the temp file cannot be written + */ + public static Path mergeYamlFiles(List files) throws IOException { + File mergedFile = Files.createTempFile("merged-operator-bundle", ".yaml", getDefaultPosixFilePermissions()).toFile(); + mergedFile.deleteOnExit(); + + try (var out = Files.newOutputStream(mergedFile.toPath())) { + for (Path file : files) { + Files.copy(file, out); + } + } + + LOGGER.debug("Merged {} files into temporary file: {}", files.size(), mergedFile.getAbsolutePath()); + return mergedFile.toPath(); + } } diff --git a/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/AbstractUpgradeST.java b/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/AbstractUpgradeST.java index 0da0ffb65..8030bddf4 100644 --- a/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/AbstractUpgradeST.java +++ b/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/AbstractUpgradeST.java @@ -1,17 +1,13 @@ package com.github.streamshub.systemtests.upgrade; import com.github.streamshub.systemtests.ResetTracingExtension; -import com.github.streamshub.systemtests.TestCaseConfig; import com.github.streamshub.systemtests.TestExecutionWatcher; import com.github.streamshub.systemtests.constants.Constants; -import com.github.streamshub.systemtests.constants.TimeConstants; import com.github.streamshub.systemtests.interfaces.BucketMethodsOrderRandomizer; import com.github.streamshub.systemtests.interfaces.ExtensionContextParameterResolver; import com.github.streamshub.systemtests.logs.LogWrapper; import com.github.streamshub.systemtests.setup.strimzi.StrimziOperatorSetup; import com.github.streamshub.systemtests.utils.SetupUtils; -import com.github.streamshub.systemtests.utils.playwright.PwPageUrls; -import com.github.streamshub.systemtests.utils.playwright.PwUtils; import com.github.streamshub.systemtests.utils.resourceutils.ClusterUtils; import com.github.streamshub.systemtests.utils.resourceutils.NamespaceUtils; import io.skodjob.kubetest4j.annotations.ResourceManager; @@ -48,19 +44,6 @@ class AbstractUpgradeST { protected static final int UNAVAILABLE_TOPICS_COUNT = 0; protected static final int TOTAL_TOPICS_COUNT = TOTAL_REPLICATED_TOPICS_COUNT + UNDER_REPLICATED_TOPICS_COUNT + UNAVAILABLE_TOPICS_COUNT; - // Old (pre-redesign) Console UI, valid for every operator version that predates the UI overhaul - // that landed after 0.12.3 (e.g. 0.11.0, 0.12.3) - shared by OlmUpgradeST and YamlUpgradeST for - // whichever side(s) of their respective upgrades still target that old UI. - protected static final String COPS_TOPICS_CARD_TOTAL_TOPICS = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > section.pf-v6-c-page__main-section > div.pf-v6-c-page__main-body > div.pf-v6-l-grid > div.pf-v6-l-grid__item:nth-of-type(2) > div.pf-v6-l-flex > div:nth-of-type(2) > div.pf-v6-c-card > div.pf-v6-c-card__body:nth-of-type(2) > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(1) > div > div.pf-v6-l-flex > div:nth-of-type(1) > div.pf-v6-c-content"; - protected static final String COPS_TOPICS_CARD_TOTAL_PARTITIONS = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > section.pf-v6-c-page__main-section > div.pf-v6-c-page__main-body > div.pf-v6-l-grid > div.pf-v6-l-grid__item:nth-of-type(2) > div.pf-v6-l-flex > div:nth-of-type(2) > div.pf-v6-c-card > div.pf-v6-c-card__body:nth-of-type(2) > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(1) > div > div.pf-v6-l-flex > div:nth-of-type(2) > div.pf-v6-c-content"; - protected static final String COPS_TOPICS_CARD_FULLY_REPLICATED = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > section.pf-v6-c-page__main-section > div.pf-v6-c-page__main-body > div.pf-v6-l-grid > div.pf-v6-l-grid__item:nth-of-type(2) > div.pf-v6-l-flex > div:nth-of-type(2) > div.pf-v6-c-card > div.pf-v6-c-card__body:nth-of-type(2) > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(2) > div:nth-of-type(1)"; - protected static final String COPS_TOPICS_CARD_UNDER_REPLICATED = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > section.pf-v6-c-page__main-section > div.pf-v6-c-page__main-body > div.pf-v6-l-grid > div.pf-v6-l-grid__item:nth-of-type(2) > div.pf-v6-l-flex > div:nth-of-type(2) > div.pf-v6-c-card > div.pf-v6-c-card__body:nth-of-type(2) > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(2) > div:nth-of-type(2)"; - protected static final String COPS_TOPICS_CARD_UNAVAILABLE = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > section.pf-v6-c-page__main-section > div.pf-v6-c-page__main-body > div.pf-v6-l-grid > div.pf-v6-l-grid__item:nth-of-type(2) > div.pf-v6-l-flex > div:nth-of-type(2) > div.pf-v6-c-card > div.pf-v6-c-card__body:nth-of-type(2) > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(2) > div:nth-of-type(3)"; - protected static final String TPS_HEADER_TOTAL_TOPICS_BADGE = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > div.pf-v6-c-page__main-group > section.pf-v6-c-page__main-section:nth-of-type(2) > div.pf-v6-c-page__main-body > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(1) > div:nth-of-type(1) > h1.pf-v6-c-title > div.pf-v6-l-split > div.pf-v6-l-split__item:nth-of-type(2) > span.pf-v6-c-label > span.pf-v6-c-label__content > span"; - protected static final String TPS_HEADER_BADGE_STATUS_SUCCESS = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > div.pf-v6-c-page__main-group > section.pf-v6-c-page__main-section:nth-of-type(2) > div.pf-v6-c-page__main-body > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(1) > div:nth-of-type(1) > h1.pf-v6-c-title > div.pf-v6-l-split > div.pf-v6-l-split__item:nth-of-type(3) > div > span.pf-v6-c-label > span.pf-v6-c-label__content > span.pf-v6-c-label__text:nth-of-type(2)"; - protected static final String TPS_HEADER_BADGE_STATUS_WARNING = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > div.pf-v6-c-page__main-group > section.pf-v6-c-page__main-section:nth-of-type(2) > div.pf-v6-c-page__main-body > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(1) > div:nth-of-type(1) > h1.pf-v6-c-title > div.pf-v6-l-split > div.pf-v6-l-split__item:nth-of-type(4) > div > span.pf-v6-c-label > span.pf-v6-c-label__content > span.pf-v6-c-label__text:nth-of-type(2)"; - protected static final String TPS_HEADER_BADGE_STATUS_ERROR = "body > div:nth-of-type(2) > div.pf-v6-c-page > div.pf-v6-c-page__main-container:nth-of-type(2) > main.pf-v6-c-page__main > div.pf-v6-c-drawer > div.pf-v6-c-drawer__main > div.pf-v6-c-drawer__content:nth-of-type(1) > div.pf-v6-c-drawer__body > div.pf-v6-c-page__main-group > section.pf-v6-c-page__main-section:nth-of-type(2) > div.pf-v6-c-page__main-body > div.pf-v6-l-flex > div.pf-v6-l-flex:nth-of-type(1) > div:nth-of-type(1) > h1.pf-v6-c-title > div.pf-v6-l-split > div.pf-v6-l-split__item:nth-of-type(5) > div > span.pf-v6-c-label > span.pf-v6-c-label__content > span.pf-v6-c-label__text:nth-of-type(2)"; - @BeforeAll void setupTestSuite(ExtensionContext extensionContext) { if (!initialized) { @@ -70,8 +53,7 @@ void setupTestSuite(ExtensionContext extensionContext) { KubeResourceManager.get().setTestContext(extensionContext); NamespaceUtils.prepareNamespace(Constants.CO_NAMESPACE); - // V1 not compatible with 0.12 console - strimziOperatorSetup.install("0.51.0"); + strimziOperatorSetup.install(); } @BeforeEach @@ -91,37 +73,4 @@ void teardownTestSuite(ExtensionContext extensionContext) { KubeResourceManager.get().setTestContext(extensionContext); SetupUtils.cleanupIfNeeded(); } - - /** - * Checks Overview/Topics page topic counts using the pre-redesign Console UI's DOM. Bypasses - * {@link PwUtils#login(TestCaseConfig)} and {@link com.github.streamshub.systemtests.utils.testchecks.TopicChecks}, - * which target the current, redesigned UI and don't match an old version's markup. - * - *

Shared by {@link OlmUpgradeST} and {@link YamlUpgradeST} for whichever side(s) of their - * respective upgrades still target the old UI. - * - * @param tcc the test case configuration - * @param totalTopicsCount expected total topic count - * @param totalReplicatedTopicsCount expected fully-replicated topic count - * @param underReplicatedTopicsCount expected under-replicated topic count - * @param unavailableTopicsCount expected unavailable topic count - */ - protected void checkOldUiTopicState(TestCaseConfig tcc, int totalTopicsCount, int totalReplicatedTopicsCount, int underReplicatedTopicsCount, int unavailableTopicsCount) { - LOGGER.info("Checking overview page topic status: {} total topics, {} partitions, {} fully replicated, {} under-replicated, {} unavailable", - totalTopicsCount, totalTopicsCount, totalReplicatedTopicsCount, underReplicatedTopicsCount, unavailableTopicsCount); - PwUtils.navigate(tcc, PwPageUrls.getOverviewPage(tcc, tcc.kafkaName())); - PwUtils.waitForContainsText(tcc, COPS_TOPICS_CARD_TOTAL_TOPICS, totalTopicsCount + " topics", true, true, TimeConstants.ACTION_WAIT_MEDIUM, Constants.SELECTOR_RETRIES); - PwUtils.waitForContainsText(tcc, COPS_TOPICS_CARD_TOTAL_PARTITIONS, totalTopicsCount + " partitions", false, true, TimeConstants.ACTION_WAIT_MEDIUM, Constants.SELECTOR_RETRIES); - PwUtils.waitForContainsText(tcc, COPS_TOPICS_CARD_FULLY_REPLICATED, totalReplicatedTopicsCount + " Fully replicated", false, true, TimeConstants.ACTION_WAIT_MEDIUM, Constants.SELECTOR_RETRIES); - PwUtils.waitForContainsText(tcc, COPS_TOPICS_CARD_UNDER_REPLICATED, underReplicatedTopicsCount + " Under replicated", false, true, TimeConstants.ACTION_WAIT_MEDIUM, Constants.SELECTOR_RETRIES); - PwUtils.waitForContainsText(tcc, COPS_TOPICS_CARD_UNAVAILABLE, unavailableTopicsCount + " Unavailable", false, true, TimeConstants.ACTION_WAIT_MEDIUM, Constants.SELECTOR_RETRIES); - - LOGGER.info("Checking topics page topic status: {} total topics, {} fully replicated, {} under-replicated, {} unavailable", - totalTopicsCount, totalReplicatedTopicsCount, underReplicatedTopicsCount, unavailableTopicsCount); - PwUtils.navigate(tcc, PwPageUrls.getTopicsPage(tcc, tcc.kafkaName())); - PwUtils.waitForContainsText(tcc, TPS_HEADER_TOTAL_TOPICS_BADGE, totalTopicsCount + " total", false, true, TimeConstants.ACTION_WAIT_MEDIUM, Constants.SELECTOR_RETRIES); - PwUtils.waitForContainsText(tcc, TPS_HEADER_BADGE_STATUS_SUCCESS, Integer.toString(totalReplicatedTopicsCount), false, true, TimeConstants.ACTION_WAIT_SHORT, Constants.SELECTOR_RETRIES); - PwUtils.waitForContainsText(tcc, TPS_HEADER_BADGE_STATUS_WARNING, Integer.toString(underReplicatedTopicsCount), false, true, TimeConstants.ACTION_WAIT_SHORT, Constants.SELECTOR_RETRIES); - PwUtils.waitForContainsText(tcc, TPS_HEADER_BADGE_STATUS_ERROR, Integer.toString(unavailableTopicsCount), false, true, TimeConstants.ACTION_WAIT_SHORT, Constants.SELECTOR_RETRIES); - } } diff --git a/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/YamlUpgradeST.java b/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/YamlUpgradeST.java index 93697a844..8c515e91e 100644 --- a/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/YamlUpgradeST.java +++ b/systemtests/src/test/java/com/github/streamshub/systemtests/upgrade/YamlUpgradeST.java @@ -14,8 +14,8 @@ import com.github.streamshub.systemtests.utils.resourceutils.NamespaceUtils; import com.github.streamshub.systemtests.utils.resourceutils.ResourceUtils; import com.github.streamshub.systemtests.utils.resourceutils.console.ConsoleUtils; -import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaNamingUtils; import com.github.streamshub.systemtests.utils.resourceutils.kafka.KafkaTopicUtils; +import com.github.streamshub.systemtests.utils.testchecks.TopicChecks; import io.fabric8.kubernetes.api.model.apps.Deployment; import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.AfterAll; @@ -38,9 +38,8 @@ public class YamlUpgradeST extends AbstractUpgradeST { /** * Verifies that upgrading the Console Operator installed from plain YAML manifests * (as opposed to OLM) correctly transitions from the old to the new operator version, - * defined in {@code src/test/resources/upgrade/YamlUpgrade.yaml} (currently version - * {@code 0.11.0} to {@code 0.12.3}), while preserving the existing Console instance - * and keeping the UI fully functional throughout. + * while preserving the existing Console instance and keeping the UI fully functional + * throughout. * *

This test performs the following steps:

*