Skip to content

Commit 0f56dfa

Browse files
revert test changes
1 parent 174e350 commit 0f56dfa

File tree

11 files changed

+30
-76
lines changed

11 files changed

+30
-76
lines changed

.github/workflows/ci-rootless-podman.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@ jobs:
1717
- name: Set XDG_RUNTIME_DIR
1818
run: echo "XDG_RUNTIME_DIR=/run/user/$UID" >> $GITHUB_ENV
1919
- name: Create registries.conf
20-
# allow pulling images without a registry specified and allow pulling from insecure local registry
20+
# allow pulling images without a registry specified
2121
run: |
2222
mkdir -p $HOME/.config/containers
2323
echo 'unqualified-search-registries = ["docker.io"]' > $HOME/.config/containers/registries.conf
24-
echo '' >> $HOME/.config/containers/registries.conf
25-
echo '[[registry]]' >> $HOME/.config/containers/registries.conf
26-
echo 'location = "localhost:50001"' >> $HOME/.config/containers/registries.conf
27-
echo 'insecure = true' >> $HOME/.config/containers/registries.conf
28-
- name: Istall latest podman release
24+
- name: Install latest podman release
2925
# see https://podman.io/getting-started/installation#ubuntu
3026
run: |
3127
sudo mkdir -p /etc/apt/keyrings

build.gradle

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,23 @@ subprojects {
9898
}
9999
}
100100

101-
// podman does not support compose
102101
if (System.properties['test.profile'] == 'podman') {
103102
exclude '**/*DockerCompose*'
103+
filter {
104+
excludeTestsMatching '*AuthenticatedImagePullTest*'
105+
excludeTestsMatching '*DockerNetworkModeTest*'
106+
excludeTestsMatching '*AmbiguousImagePullTest*'
107+
excludeTestsMatching '*ImagePullPolicyTest*'
108+
109+
excludeTestsMatching '*testThatAuthLocatorIsUsedForDockerComposePull'
110+
excludeTestsMatching '*testMemoryLimitModified'
111+
excludeTestsMatching '*testBuilder'
112+
excludeTestsMatching '*testModifiers'
113+
excludeTestsMatching '*shouldOnlyPublishExposedPorts'
114+
excludeTestsMatching '*shouldReportOOMAfterWait'
115+
excludeTestsMatching '*runCommandInsideDockerShouldNotFailIfImageDoesNotExistsLocally'
116+
}
117+
104118
}
105119
}
106120

core/src/main/java/org/testcontainers/DockerClientFactory.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.commons.lang3.SystemUtils;
2222
import org.testcontainers.dockerclient.DockerClientProviderStrategy;
2323
import org.testcontainers.dockerclient.DockerMachineClientProviderStrategy;
24-
import org.testcontainers.dockerclient.RootlessPodmanClientProviderStrategy;
2524
import org.testcontainers.dockerclient.TransportConfig;
2625
import org.testcontainers.images.RemoteDockerImage;
2726
import org.testcontainers.images.TimeLimitedLoggedPullImageResultCallback;
@@ -382,9 +381,4 @@ public boolean isUsing(Class<? extends DockerClientProviderStrategy> providerStr
382381
public Info getInfo() {
383382
return getOrInitializeStrategy().getInfo();
384383
}
385-
386-
public boolean supportsCompose() {
387-
// podman does not support compose
388-
return !(getOrInitializeStrategy() instanceof RootlessPodmanClientProviderStrategy);
389-
}
390384
}

core/src/main/java/org/testcontainers/utility/TestEnvironment.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ public static boolean dockerApiAtLeast(String minimumVersion) {
1717
return current.compareTo(min) >= 0;
1818
}
1919

20-
public static boolean clientSupportsCompose() {
21-
return DockerClientFactory.instance().supportsCompose();
22-
}
23-
2420
public static boolean dockerExecutionDriverSupportsExec() {
2521
String executionDriver = DockerClientFactory.instance().getActiveExecutionDriver();
2622

core/src/test/java/org/testcontainers/DockerRegistryContainer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public DockerRegistryContainer(@NonNull Future<String> image) {
3737
@Override
3838
protected void configure() {
3939
super.configure();
40-
withEnv("REGISTRY_HTTP_ADDR", "127.0.0.1:50001");
40+
withEnv("REGISTRY_HTTP_ADDR", "127.0.0.1:0");
4141
withCreateContainerCmdModifier(cmd -> {
4242
cmd.getHostConfig().withNetworkMode("host");
4343
});
@@ -77,7 +77,7 @@ protected void containerIsStarting(InspectContainerResponse containerInfo) {
7777
);
7878
}
7979

80-
endpoint = "http://" + getHost() + ":" + port.get();
80+
endpoint = getHost() + ":" + port.get();
8181
}
8282

8383
public DockerImageName createImage() {
@@ -96,7 +96,7 @@ public DockerImageName createImage(String originalImage, String tag) {
9696
String dummyImageId = client.inspectImageCmd(originalImage).exec().getId();
9797

9898
DockerImageName imageName = DockerImageName
99-
.parse(getEndpoint().replaceFirst("http://", "") + "/" + Base58.randomString(6).toLowerCase())
99+
.parse(getEndpoint() + "/" + Base58.randomString(6).toLowerCase())
100100
.withTag(tag);
101101

102102
// push the image to the registry

core/src/test/java/org/testcontainers/containers/GenericContainerTest.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.Arrays;
2626
import java.util.List;
2727
import java.util.Map;
28-
import java.util.Objects;
2928
import java.util.concurrent.TimeUnit;
3029
import java.util.function.Predicate;
3130
import java.util.stream.Collectors;
@@ -41,8 +40,6 @@ public void shouldReportOOMAfterWait() {
4140
Info info = DockerClientFactory.instance().client().infoCmd().exec();
4241
// Poor man's rootless Docker detection :D
4342
Assumptions.assumeThat(info.getSecurityOptions()).doesNotContain("rootless");
44-
// setting swappiness is not allowed for cgroups v2
45-
Assumptions.assumeThat(info.getRawValues().get("CgroupVersion")).isNotEqualTo("2");
4643
try (
4744
GenericContainer<?> container = new GenericContainer<>(TestImages.TINY_IMAGE)
4845
.withStartupCheckStrategy(new NoopStartupCheckStrategy())
@@ -139,13 +136,7 @@ public void shouldOnlyPublishExposedPorts() {
139136
.getHostConfig()
140137
.getPortBindings()
141138
.getBindings();
142-
// podman also returns unbound ports, but sets the binding value to null
143-
List<Ports.Binding[]> boundPorts = hostBindings
144-
.values()
145-
.stream()
146-
.filter(Objects::nonNull)
147-
.collect(Collectors.toList());
148-
assertThat(boundPorts).as("only 1 port is bound on the host (published)").hasSize(1);
139+
assertThat(hostBindings).as("only 1 port is bound on the host (published)").hasSize(1);
149140

150141
Integer mappedPort = container.getMappedPort(8080);
151142
assertThat(mappedPort != 8080).as("port 8080 is bound to a different port on the host").isTrue();

core/src/test/java/org/testcontainers/containers/NetworkTest.java

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.testcontainers.containers;
22

3-
import com.github.dockerjava.api.model.Network.Ipam;
43
import org.junit.Rule;
54
import org.junit.Test;
65
import org.junit.experimental.runners.Enclosed;
@@ -66,19 +65,7 @@ public void testNetworkSupport() throws Exception {
6665

6766
@Test
6867
public void testBuilder() {
69-
try (
70-
Network network = Network
71-
.builder()
72-
.driver("macvlan")
73-
.createNetworkCmdModifier(cmd -> {
74-
cmd.withIpam(
75-
// mcvlan needs a subnet or podman will refuse to create the network
76-
// https://docs.podman.io/en/latest/markdown/podman-network-create.1.html#driver-d
77-
new Ipam().withConfig(new Ipam.Config().withSubnet("192.168.100.1/25"))
78-
);
79-
})
80-
.build()
81-
) {
68+
try (Network network = Network.builder().driver("macvlan").build()) {
8269
String id = network.getId();
8370
assertThat(
8471
DockerClientFactory.instance().client().inspectNetworkCmd().withNetworkId(id).exec().getDriver()
@@ -91,19 +78,7 @@ public void testBuilder() {
9178
@Test
9279
public void testModifiers() {
9380
try (
94-
Network network = Network
95-
.builder()
96-
.createNetworkCmdModifier(cmd -> {
97-
cmd
98-
.withDriver("macvlan")
99-
.withIpam(
100-
new Ipam()
101-
// mcvlan needs a subnet or podman will refuse to create the network
102-
// https://docs.podman.io/en/latest/markdown/podman-network-create.1.html#driver-d
103-
.withConfig(new Ipam.Config().withSubnet("192.168.100.1/25"))
104-
);
105-
})
106-
.build()
81+
Network network = Network.builder().createNetworkCmdModifier(cmd -> cmd.withDriver("macvlan")).build()
10782
) {
10883
String id = network.getId();
10984
assertThat(

core/src/test/java/org/testcontainers/containers/wait/strategy/DockerHealthcheckWaitStrategyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void setUp() {
2727
)
2828
.withFileFromClasspath("Dockerfile", "health-wait-strategy-dockerfile/Dockerfile")
2929
)
30-
.waitingFor(Wait.forHealthcheck().withStartupTimeout(Duration.ofSeconds(5)));
30+
.waitingFor(Wait.forHealthcheck().withStartupTimeout(Duration.ofSeconds(3)));
3131
}
3232

3333
@Test

core/src/test/java/org/testcontainers/junit/DockerNetworkModeTest.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ public void testNoNetworkContainer() {
2727
container.start();
2828
NetworkSettings networkSettings = container.getContainerInfo().getNetworkSettings();
2929

30-
assertThat(networkSettings.getNetworks())
31-
.as("only one network is set")
32-
.allSatisfy((name, containerNetwork) -> {
33-
assertThat(name).as("network is 'none'").isEqualTo("none");
34-
});
30+
assertThat(networkSettings.getNetworks()).as("only one network is set").hasSize(1);
31+
assertThat(networkSettings.getNetworks()).as("network is 'none'").containsKey("none");
3532
}
3633
}
3734

@@ -46,11 +43,8 @@ public void testHostNetworkContainer() {
4643
container.start();
4744
NetworkSettings networkSettings = container.getContainerInfo().getNetworkSettings();
4845

49-
assertThat(networkSettings.getNetworks())
50-
.as("only one network is set")
51-
.allSatisfy((name, containerNetwork) -> {
52-
assertThat(networkSettings.getNetworks()).as("network is 'host'").containsKey("host");
53-
});
46+
assertThat(networkSettings.getNetworks()).as("only one network is set").hasSize(1);
47+
assertThat(networkSettings.getNetworks()).as("network is 'host'").containsKey("host");
5448
}
5549
}
5650
}

core/src/test/java/org/testcontainers/utility/AuthenticatedImagePullTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.github.dockerjava.api.model.AuthConfig;
44
import org.intellij.lang.annotations.Language;
55
import org.junit.AfterClass;
6-
import org.junit.Assume;
76
import org.junit.BeforeClass;
87
import org.junit.ClassRule;
98
import org.junit.Test;
@@ -64,14 +63,14 @@ public static void beforeClass() throws Exception {
6463
final AuthConfig authConfig = new AuthConfig()
6564
.withUsername("testuser")
6665
.withPassword("notasecret")
67-
.withRegistryAddress(testRegistryAddress);
66+
.withRegistryAddress("http://" + testRegistryAddress);
6867

6968
// Replace the RegistryAuthLocator singleton with our mock, for the duration of this test
7069
final RegistryAuthLocator mockAuthLocator = Mockito.mock(RegistryAuthLocator.class);
7170
RegistryAuthLocator.setInstance(mockAuthLocator);
7271
when(
7372
mockAuthLocator.lookupAuthConfig(
74-
argThat(argument -> testRegistryAddress.replaceFirst("http://", "").equals(argument.getRegistry())),
73+
argThat(argument -> testRegistryAddress.equals(argument.getRegistry())),
7574
any()
7675
)
7776
)
@@ -118,7 +117,6 @@ public void testThatAuthLocatorIsUsedForDockerfileBuild() throws IOException {
118117

119118
@Test
120119
public void testThatAuthLocatorIsUsedForDockerComposePull() throws IOException {
121-
Assume.assumeTrue(TestEnvironment.clientSupportsCompose());
122120
// Prepare a simple temporary Docker Compose manifest which requires our custom private image
123121
Path tempFile = getLocalTempFile(".docker-compose.yml");
124122
@Language("yaml")

0 commit comments

Comments
 (0)