|
17 | 17 | import org.testcontainers.containers.output.Slf4jLogConsumer;
|
18 | 18 | import org.testcontainers.containers.wait.strategy.Wait;
|
19 | 19 | import org.testcontainers.images.PullPolicy;
|
20 |
| -import org.testcontainers.shaded.com.google.common.collect.ImmutableList; |
21 | 20 |
|
22 | 21 | import java.io.File;
|
23 | 22 | import java.io.FileWriter;
|
|
27 | 26 | import java.nio.file.Path;
|
28 | 27 | import java.time.Duration;
|
29 | 28 | import java.time.Instant;
|
| 29 | +import java.util.Arrays; |
| 30 | +import java.util.Collections; |
30 | 31 | import java.util.HashMap;
|
31 | 32 | import java.util.List;
|
32 | 33 | import java.util.Map;
|
|
40 | 41 | public class TestUpgrade
|
41 | 42 | {
|
42 | 43 | private static final Logger log = LoggerFactory.getLogger( TestUpgrade.class );
|
43 |
| - ImmutableList<String> readonlyMounts = ImmutableList.of( "conf" ); |
44 |
| - ImmutableList<String> writableMounts = ImmutableList.of( "data", "logs", "metrics" ); |
| 44 | + private static final List<String> readonlyMounts = Collections.singletonList( "conf" ); |
| 45 | + private static final List<String> writableMounts = getWriteableMounts(); |
| 46 | + |
45 | 47 | private final String user = "neo4j";
|
46 | 48 | private final String password = "quality";
|
47 | 49 |
|
@@ -104,6 +106,7 @@ void canUpgradeFromBeforeFilePermissionFix35() throws Exception
|
104 | 106 | }
|
105 | 107 | }
|
106 | 108 |
|
| 109 | + // TODO: parameterize these tests for different configurations (e.g. running as non-root user) |
107 | 110 | @Test
|
108 | 111 | void canUpgradeFromSameMinorVersion() throws Exception
|
109 | 112 | {
|
@@ -297,4 +300,19 @@ private static String releaseImageName( int major, int minor )
|
297 | 300 | return String.format( "neo4j:%d.%d%s", major, minor,
|
298 | 301 | (TestSettings.EDITION == TestSettings.Edition.ENTERPRISE) ? "-enterprise" : "" );
|
299 | 302 | }
|
| 303 | + |
| 304 | + private static List<String> getWriteableMounts() |
| 305 | + { |
| 306 | + switch ( TestSettings.EDITION ) |
| 307 | + { |
| 308 | + case COMMUNITY: |
| 309 | + return Arrays.asList( "data", "logs" ); |
| 310 | + case ENTERPRISE: |
| 311 | + // /metrics doesn't get chowned in 3.x so doesn't always work |
| 312 | + return TestSettings.NEO4J_VERSION.major < 4 ? Arrays.asList( "data", "logs" ) : Arrays.asList( "data", "logs", "metrics" ); |
| 313 | + default: |
| 314 | + Assertions.fail( "Unknown Edition: " + TestSettings.EDITION ); |
| 315 | + return Collections.emptyList(); |
| 316 | + } |
| 317 | + } |
300 | 318 | }
|
0 commit comments