Skip to content

Commit

Permalink
VBV-1471: Enhance the mock Docker adapter to support HA mode: Containers
Browse files Browse the repository at this point in the history
Fix to support HA mode for container mock adapter: it adds a new StatefulService
MockDockerContainerToHostService to keep track of containers in each host.

Change-Id: Ic0c9456bf5bbadb0c47e9260178921061b8f0c9f
Reviewed-on: http://bellevue-ci.eng.vmware.com:8080/16440
Closures-Verified: jenkins <[email protected]>
Upgrade-Verified: jenkins <[email protected]>
Bellevue-Verified: jenkins <[email protected]>
CS-Verified: jenkins <[email protected]>
Reviewed-by: Lazarin Lazarov <[email protected]>
  • Loading branch information
jdillet committed Sep 5, 2017
1 parent bdb5de8 commit 09124f0
Show file tree
Hide file tree
Showing 20 changed files with 471 additions and 362 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.vmware.admiral.common.DeploymentProfileConfig;
import com.vmware.admiral.service.test.MockComputeHostInstanceAdapter;
import com.vmware.admiral.service.test.MockDockerAdapterService;
import com.vmware.admiral.service.test.MockDockerContainerToHostService;
import com.vmware.admiral.service.test.MockDockerHostAdapterImageService;
import com.vmware.admiral.service.test.MockDockerHostAdapterService;
import com.vmware.admiral.service.test.MockDockerNetworkAdapterService;
Expand All @@ -40,8 +41,8 @@ public static void startServices(ServiceHost host, boolean startMockHostAdapterI
if (startMockHostAdapterInstance) {
DeploymentProfileConfig.getInstance().setTest(true);
host.startService(Operation.createPost(UriUtils.buildUri(host,
MockDockerAdapterService.class)),
new MockDockerAdapterService());
MockDockerAdapterService.class)), new MockDockerAdapterService());
host.startFactory(new MockDockerContainerToHostService());

host.startService(Operation.createPost(UriUtils.buildUri(host,
MockDockerHostAdapterService.class)), new MockDockerHostAdapterService());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import javax.net.ssl.TrustManager;

import org.junit.Before;
Expand All @@ -40,7 +41,6 @@
import com.vmware.admiral.compute.container.PortBinding;
import com.vmware.admiral.compute.container.SystemContainerDescriptions;
import com.vmware.admiral.service.common.ServiceTaskCallback;
import com.vmware.admiral.service.test.MockDockerAdapterService;
import com.vmware.photon.controller.model.resources.ComputeDescriptionService;
import com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription;
import com.vmware.photon.controller.model.resources.ComputeService;
Expand Down Expand Up @@ -70,7 +70,6 @@ public void startServices() throws Throwable {
Operation.createPost(UriUtils.buildUri(
mockDockerHost, MockDockerHostService.SELF_LINK)),
new MockDockerHostService());
MockDockerAdapterService.resetContainers();
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import com.vmware.admiral.common.DeploymentProfileConfig;
import com.vmware.admiral.compute.ComputeConstants;
import com.vmware.admiral.compute.ContainerHostService;
import com.vmware.admiral.service.test.MockDockerAdapterService;
import com.vmware.admiral.service.test.MockDockerHostAdapterService;
import com.vmware.photon.controller.model.resources.ComputeDescriptionService;
import com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription;
Expand All @@ -53,7 +52,6 @@ public void startServices() throws Throwable {
Operation.createPost(UriUtils.buildUri(
mockDockerHost, MockVicHostService.SELF_LINK)),
new MockVicHostService());
MockDockerAdapterService.resetContainers();
}

@Before
Expand Down Expand Up @@ -91,15 +89,15 @@ protected void createVicHostComputeState() throws Throwable {
waitForServiceAvailability(ComputeService.FACTORY_LINK);

ComputeDescription computeDescription = new ComputeDescription();
computeDescription.customProperties = new HashMap<String, String>();
computeDescription.customProperties = new HashMap<>();
computeDescription.id = UUID.randomUUID().toString();
String computeDescriptionLink = doPost(computeDescription,
ComputeDescriptionService.FACTORY_LINK).documentSelfLink;

ComputeState computeState = new ComputeState();
computeState.id = "testVCHComputeState";
computeState.descriptionLink = computeDescriptionLink;
computeState.customProperties = new HashMap<String, String>();
computeState.customProperties = new HashMap<>();
computeState.customProperties.put(
ComputeConstants.HOST_AUTH_CREDENTIALS_PROP_NAME, testDockerCredentialsLink);
computeState.customProperties.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public interface ManagementUriParts {
String CONTAINER_LOGS = RESOURCES + "/container-logs";
String CONTAINER_SHELL = RESOURCES + "/container-shell";
String CONTAINER_DESC = RESOURCES + "/container" + DESCRIPTION_SUFFIX;
String MOCK_CONTAINERS = CONTAINERS + "-mock";

String COMPOSITE_DESC = RESOURCES + "/composite" + DESCRIPTION_SUFFIX;
String COMPOSITE_DESC_CLONE = RESOURCES + "/composite" + DESCRIPTION_SUFFIX + CLONE_SUFFIX;
String COMPOSITE_DESC_CONTENT = RESOURCES + "/composite-templates";
Expand Down
Loading

0 comments on commit 09124f0

Please sign in to comment.