Skip to content

Commit

Permalink
handle the difference between community and enterprise mountable dire…
Browse files Browse the repository at this point in the history
…ctories in TestUpgrade
  • Loading branch information
Andrew Jefferson committed Jun 23, 2020
1 parent ea936c4 commit 6cb6586
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/test/java/com/neo4j/docker/TestUpgrade.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.PullPolicy;
import org.testcontainers.shaded.com.google.common.collect.ImmutableList;

import java.io.File;
import java.io.FileWriter;
Expand All @@ -27,6 +26,8 @@
import java.nio.file.Path;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -40,8 +41,9 @@
public class TestUpgrade
{
private static final Logger log = LoggerFactory.getLogger( TestUpgrade.class );
ImmutableList<String> readonlyMounts = ImmutableList.of( "conf" );
ImmutableList<String> writableMounts = ImmutableList.of( "data", "logs", "metrics" );
private static final List<String> readonlyMounts = Collections.singletonList( "conf" );
private static final List<String> writableMounts = getWriteableMounts();

private final String user = "neo4j";
private final String password = "quality";

Expand Down Expand Up @@ -104,6 +106,7 @@ void canUpgradeFromBeforeFilePermissionFix35() throws Exception
}
}

// TODO: parameterize these tests for different configurations (e.g. running as non-root user)
@Test
void canUpgradeFromSameMinorVersion() throws Exception
{
Expand Down Expand Up @@ -297,4 +300,19 @@ private static String releaseImageName( int major, int minor )
return String.format( "neo4j:%d.%d%s", major, minor,
(TestSettings.EDITION == TestSettings.Edition.ENTERPRISE) ? "-enterprise" : "" );
}

private static List<String> getWriteableMounts()
{
switch ( TestSettings.EDITION )
{
case COMMUNITY:
return Arrays.asList( "data", "logs" );
case ENTERPRISE:
// /metrics doesn't get chowned in 3.x so doesn't always work
return TestSettings.NEO4J_VERSION.major < 4 ? Arrays.asList( "data", "logs" ) : Arrays.asList( "data", "logs", "metrics" );
default:
Assertions.fail( "Unknown Edition: " + TestSettings.EDITION );
return Collections.emptyList();
}
}
}

0 comments on commit 6cb6586

Please sign in to comment.