//[Test] public void TestListContainers() { // Act var containerSummary = _containerApi.ContainerList(); // Assert Assert.NotNull(containerSummary); }
public IRunspaceInfo[] List() { List <IRunspaceInfo> result = new List <IRunspaceInfo>(); try { var runningRunspaceContainerList = _containerApi.ContainerList(); foreach (var runspaceContainer in runningRunspaceContainerList) { if (runspaceContainer != null && runspaceContainer.Image == _runspaceContainerCreateSpec.ImageName && runspaceContainer.State.ToLower() == "running") { var containerInspectResponse = _containerApi.ContainerInspect(runspaceContainer.Id); result.Add(DockerRunspaceInfo.FromContainerInspectResponse( containerInspectResponse, _runspaceContainerCreateSpec.NetworkName)); } } } catch (ApiException dockerApiException) { throw new RunspaceProviderException( Resources.Resources.DockerRunspaceProvider_Get_ContainerDockerAPIFail, dockerApiException); } // Populate Result from ContainerInspectResponse return(result.ToArray()); }
//[Test] public void TestKillRunsapceContainer() { // Arrange var runspaceInfo = _runspaceProvider.StartCreate(); runspaceInfo = _runspaceProvider.WaitCreateCompletion(runspaceInfo); // Act _runspaceProvider.Kill(runspaceInfo.Id); // Assert var runningContainers = _containerApi.ContainerList(); Assert.IsEmpty(runningContainers); }