Search in sources :

Example 1 with RunVolumeConfiguration

use of io.fabric8.maven.docker.config.RunVolumeConfiguration in project docker-maven-plugin by fabric8io.

the class VolumeBindingUtilTest method testResolveVolumeBindingsWithRunVolumeConfiguration.

/**
 * Insures that relative paths in the host portion of a volume binding string are properly resolved against a base
 * directory when present in a {@link RunVolumeConfiguration}.
 */
@Test
public void testResolveVolumeBindingsWithRunVolumeConfiguration() {
    RunVolumeConfiguration.Builder builder = new RunVolumeConfiguration.Builder();
    builder.bind(singletonList(format(BIND_STRING_FMT, RELATIVE_PATH, CONTAINER_PATH)));
    RunVolumeConfiguration volumeConfiguration = builder.build();
    // './rel:/path/to/container/dir' to '/absolute/basedir/rel:/path/to/container/dir'
    resolveRelativeVolumeBindings(ABS_BASEDIR, volumeConfiguration);
    String expectedBindingString = format(BIND_STRING_FMT, join("", ABS_BASEDIR.getAbsolutePath(), stripLeadingPeriod(RELATIVE_PATH)), CONTAINER_PATH);
    assertEquals(expectedBindingString, volumeConfiguration.getBind().get(0));
}
Also used : RunVolumeConfiguration(io.fabric8.maven.docker.config.RunVolumeConfiguration) Test(org.junit.Test)

Aggregations

RunVolumeConfiguration (io.fabric8.maven.docker.config.RunVolumeConfiguration)1 Test (org.junit.Test)1