use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class DockerConfigReaderTest method testFromDockerConfig_FullDockerCfg.
@Test
public void testFromDockerConfig_FullDockerCfg() throws Exception {
final RegistryAuth registryAuth = reader.fromFirstConfig(getTestFilePath("dockerConfig/fullDockerCfg"));
assertThat(registryAuth, equalTo(DOCKER_AUTH_CONFIG));
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class FixedRegistryAuthSupplierTest method authForReturnsWrappedAuthRegistry.
@Test
public void authForReturnsWrappedAuthRegistry() throws DockerException {
final RegistryAuth registryAuth = mock(RegistryAuth.class);
FixedRegistryAuthSupplier fixedRegistryAuthSupplier = new FixedRegistryAuthSupplier(registryAuth, null);
assertEquals(registryAuth, fixedRegistryAuthSupplier.authFor("doesn't matter"));
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class PushPullIT method testPullHubPrivateImageWithAuth.
@Test
public void testPullHubPrivateImageWithAuth() throws Exception {
final RegistryAuth registryAuth = RegistryAuth.builder().username(HUB_AUTH_USERNAME2).password(HUB_AUTH_PASSWORD2).build();
client.pull("dxia2/scratch-private:latest", registryAuth);
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class PushPullIT method setup.
@Before
public void setup() throws Exception {
final RegistryAuth registryAuth = RegistryAuth.builder().username(LOCAL_AUTH_USERNAME).password(LOCAL_AUTH_PASSWORD).build();
client = DefaultDockerClient.fromEnv().registryAuthSupplier(new FixedRegistryAuthSupplier(registryAuth, RegistryConfigs.create(singletonMap(HUB_NAME, registryAuth)))).build();
System.out.printf("- %s\n", testName.getMethodName());
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class PushPullIT method testPushImageToPrivateAuthedRegistryWithAuth.
@Test
public void testPushImageToPrivateAuthedRegistryWithAuth() throws Exception {
registryContainerId = startAuthedRegistry(client);
// Push an image to the private registry and check it succeeds
final String dockerDirectory = Resources.getResource("dockerDirectory").getPath();
client.build(Paths.get(dockerDirectory), LOCAL_IMAGE);
client.tag(LOCAL_IMAGE, LOCAL_IMAGE_2);
client.push(LOCAL_IMAGE);
// Push the same image again under a different user
final RegistryAuth registryAuth = RegistryAuth.builder().username(LOCAL_AUTH_USERNAME_2).password(LOCAL_AUTH_PASSWORD_2).build();
client.push(LOCAL_IMAGE_2, registryAuth);
// We should be able to pull it again
client.pull(LOCAL_IMAGE);
client.pull(LOCAL_IMAGE_2);
}
Aggregations