Skip to content

Commit b63512a

Browse files
authored
upgrade test frame version (kroxylicious#2127)
* upgrade test frame version Signed-off-by: Francisco Vila <fvila@redhat.com> * upgrade test frame version Signed-off-by: Francisco Vila <fvila@redhat.com> --------- Signed-off-by: Francisco Vila <fvila@redhat.com> Signed-off-by: Francisco Vila <57452611+franvila@users.noreply.github.com>
1 parent 38c9c7e commit b63512a

File tree

3 files changed

+3
-57
lines changed

3 files changed

+3
-57
lines changed

kroxylicious-systemtests/src/main/java/io/kroxylicious/systemtests/resources/operator/KroxyliciousOperatorBundleInstaller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
import io.skodjob.testframe.enums.InstallType;
3131
import io.skodjob.testframe.installation.InstallationMethod;
3232
import io.skodjob.testframe.resources.KubeResourceManager;
33+
import io.skodjob.testframe.utils.ImageUtils;
3334
import io.skodjob.testframe.utils.TestFrameUtils;
3435

3536
import io.kroxylicious.systemtests.Constants;
3637
import io.kroxylicious.systemtests.Environment;
3738
import io.kroxylicious.systemtests.k8s.KubeClusterResource;
3839
import io.kroxylicious.systemtests.utils.DeploymentUtils;
3940
import io.kroxylicious.systemtests.utils.NamespaceUtils;
40-
import io.kroxylicious.systemtests.utils.TestUtils;
4141

4242
import static io.kroxylicious.systemtests.k8s.KubeClusterResource.kubeClient;
4343

@@ -139,7 +139,7 @@ private void applyDeploymentFile() {
139139
.endMetadata()
140140
.editSpec()
141141
.editFirstContainer()
142-
.withImage(TestUtils.changeRegistryOrgImageAndTag(deploymentImage, Environment.KROXYLICIOUS_OPERATOR_REGISTRY,
142+
.withImage(ImageUtils.changeRegistryOrgImageAndTag(deploymentImage, Environment.KROXYLICIOUS_OPERATOR_REGISTRY,
143143
Environment.KROXYLICIOUS_OPERATOR_ORG, Environment.KROXYLICIOUS_OPERATOR_IMAGE, Environment.KROXYLICIOUS_OPERATOR_VERSION))
144144
.withImagePullPolicy(Constants.PULL_IMAGE_IF_NOT_PRESENT)
145145
.endContainer()

kroxylicious-systemtests/src/main/java/io/kroxylicious/systemtests/utils/TestUtils.java

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
import java.nio.file.attribute.PosixFilePermission;
1717
import java.nio.file.attribute.PosixFilePermissions;
1818
import java.util.Set;
19-
import java.util.regex.Matcher;
20-
import java.util.regex.Pattern;
21-
22-
import org.slf4j.Logger;
23-
import org.slf4j.LoggerFactory;
2419

2520
import com.fasterxml.jackson.databind.ObjectMapper;
2621

@@ -31,10 +26,7 @@
3126
* The type Test utils.
3227
*/
3328
public class TestUtils {
34-
private static final Logger LOGGER = LoggerFactory.getLogger(TestUtils.class);
3529
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
36-
private static final Pattern IMAGE_PATTERN_FULL_PATH = Pattern.compile("^(?<registry>[^/]*)/(?<org>[^/]*)/(?<image>[^:]*):(?<tag>.*)$");
37-
private static final Pattern IMAGE_PATTERN = Pattern.compile("^(?<org>[^/]*)/(?<image>[^:]*):(?<tag>.*)$");
3830

3931
private TestUtils() {
4032
}
@@ -112,50 +104,4 @@ public static String getJsonFileContent(String fileName) {
112104
throw new UncheckedIOException(e);
113105
}
114106
}
115-
116-
// TO BE REMOVED when introduced in ImageUtils from TestFrame project
117-
118-
/**
119-
* Change registry org image and tag.
120-
*
121-
* @param imageRepo the image repo
122-
* @param newRegistry the new registry
123-
* @param newOrg the new org
124-
* @param newImage the new image
125-
* @param newTag the new tag
126-
* @return the string
127-
*/
128-
public static String changeRegistryOrgImageAndTag(String imageRepo, String newRegistry, String newOrg, String newImage, String newTag) {
129-
Matcher m = IMAGE_PATTERN_FULL_PATH.matcher(imageRepo);
130-
if (m.find()) {
131-
String registry = setImagePropertiesIfNeeded(m.group("registry"), newRegistry);
132-
String org = setImagePropertiesIfNeeded(m.group("org"), newOrg);
133-
String tag = setImagePropertiesIfNeeded(m.group("tag"), newTag);
134-
String image = setImagePropertiesIfNeeded(m.group("image"), newImage);
135-
136-
String newImageRepo = registry + "/" + org + "/" + image + ":" + tag;
137-
LOGGER.info("Updating container image to {}", newImageRepo);
138-
return newImageRepo;
139-
}
140-
else {
141-
m = IMAGE_PATTERN.matcher(imageRepo);
142-
if (m.find()) {
143-
String registry = newRegistry != null ? newRegistry + "/" : "";
144-
String org = setImagePropertiesIfNeeded(m.group("org"), newOrg);
145-
String tag = setImagePropertiesIfNeeded(m.group("tag"), newTag);
146-
String image = setImagePropertiesIfNeeded(m.group("image"), newImage);
147-
148-
String newImageRepo = registry + org + "/" + image + ":" + tag;
149-
LOGGER.info("Updating container image to {}", newImageRepo);
150-
return newImageRepo;
151-
}
152-
else {
153-
return imageRepo;
154-
}
155-
}
156-
}
157-
158-
private static String setImagePropertiesIfNeeded(String currentValue, String newValue) {
159-
return newValue != null && !newValue.isEmpty() && !currentValue.equals(newValue) ? newValue : currentValue;
160-
}
161107
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<netty-leak-detector-junit-extension.version>0.0.8</netty-leak-detector-junit-extension.version>
7979
<wiremock.version>3.13.0</wiremock.version>
8080
<docker-java.version>3.5.0</docker-java.version>
81-
<test-frame.version>0.12.0</test-frame.version>
81+
<test-frame.version>0.13.0</test-frame.version>
8282
<junit-pioneer.version>2.3.0</junit-pioneer.version>
8383
<skip-validate-yaml-snippets>true</skip-validate-yaml-snippets>
8484
</properties>

0 commit comments

Comments
 (0)