This repository has been archived by the owner on Mar 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure RegistryAuth email is set in tests
testAuth and testBadAuth is failing on Docker 1.9 and 1.10 because RegistryAuth.email is not set when we send it to the daemon
- Loading branch information
Showing
2 changed files
with
7 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,9 +41,6 @@ | |
@JsonAutoDetect(fieldVisibility = ANY, getterVisibility = NONE, setterVisibility = NONE) | ||
public abstract class RegistryAuth { | ||
|
||
private static final String DEFAULT_REGISTRY = "https://index.docker.io/v1/"; | ||
private static final String DUMMY_EMAIL = "[email protected]"; | ||
|
||
@SuppressWarnings("FieldCanBeLocal") | ||
private static final ObjectMapper MAPPER = | ||
new ObjectMapperProvider().getContext(RegistryAuth.class); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -301,19 +301,22 @@ public class DefaultDockerClientTest { | |
@Rule | ||
public final TestName testName = new TestName(); | ||
|
||
private final RegistryAuth registryAuth = RegistryAuth.builder() | ||
.username(AUTH_USERNAME) | ||
.password(AUTH_PASSWORD) | ||
.email("[email protected]") | ||
.build(); | ||
|
||
private final String nameTag = toHexString(ThreadLocalRandom.current().nextLong()); | ||
|
||
private URI dockerEndpoint; | ||
|
||
private DefaultDockerClient sut; | ||
|
||
private RegistryAuth registryAuth; | ||
|
||
private String dockerApiVersion; | ||
|
||
@Before | ||
public void setup() throws Exception { | ||
registryAuth = RegistryAuth.builder().username(AUTH_USERNAME).password(AUTH_PASSWORD).build(); | ||
final DefaultDockerClient.Builder builder = DefaultDockerClient.fromEnv(); | ||
// Make it easier to test no read timeout occurs by using a smaller value | ||
// Such test methods should end in 'NoTimeout' | ||
|
@@ -678,6 +681,7 @@ public void testAuth() throws Exception { | |
public void testBadAuth() throws Exception { | ||
final RegistryAuth badRegistryAuth = RegistryAuth.builder() | ||
.username(AUTH_USERNAME) | ||
.email("[email protected]") // docker < 1.11 requires email to be set in RegistryAuth | ||
.password("foobar") | ||
.build(); | ||
final int statusCode = sut.auth(badRegistryAuth); | ||
|