public void ShouldNotDeleteImageIfContainerExistsButNotInBlacklist() { var strategyA = new TestStrategy(new Matchlist(), new Matchlist("dead,exited,pause")); var strategyB = new TestStrategy(new Matchlist(), new Matchlist("dead,exited")); var image = new DockerImageNode() { InspectResponse = new ImageInspectResponse() { ID = "A", Created = DateTime.UtcNow.AddDays(-1), // 1 day }, Containers = new List <ContainerInspectResponse>() { new ContainerInspectResponse() { State = new ContainerState() { Status = "pause", FinishedAt = DateTime.UtcNow.ToString(), }, } }, }; Assert.True(strategyA.CanDelete(image)); Assert.False(strategyB.CanDelete(image)); }
public void ShouldDeleteImageIfNoContainerUsage() { var strategy = new TestStrategy(new Matchlist(), new Matchlist("dead,exited")); var image = new DockerImageNode() { InspectResponse = new ImageInspectResponse() { ID = "A", Created = DateTime.UtcNow.AddDays(-1), // 1 day } }; Assert.True(strategy.CanDelete(image)); }