public void TestThatIsInternalImageWorks() { var fileSystem = new MockFileSystem(); AddImageConfigToFileSystem(fileSystem, "Testing"); var manager = new ImageSourceManager(new NullLogger <ImageSourceManager>(), fileSystem); Assert.IsTrue(manager.IsInternalImage(new DockerImageId("Testing", "1.0"))); }
public void TestThatRefreshSourcesUpdatesCorrectlyWhenUsedAtRuntime() { var fileSystem = new MockFileSystem(); AddImageConfigToFileSystem(fileSystem, "Testing"); var manager = new ImageSourceManager(new NullLogger <ImageSourceManager>(), fileSystem); AddImageConfigToFileSystem(fileSystem, "Steve"); Assert.IsTrue(manager.IsInternalImage(new DockerImageId("Testing", "1.0"))); Assert.IsFalse(manager.IsInternalImage(new DockerImageId("Steve", "1.0"))); manager.RefreshInternalSources(); Assert.IsTrue(manager.IsInternalImage(new DockerImageId("Testing", "1.0"))); Assert.IsTrue(manager.IsInternalImage(new DockerImageId("Steve", "1.0"))); RemoveImageConfigFromFileSystem(fileSystem, "Testing"); manager.RefreshInternalSources(); Assert.IsFalse(manager.IsInternalImage(new DockerImageId("Testing", "1.0"))); Assert.IsTrue(manager.IsInternalImage(new DockerImageId("Steve", "1.0"))); }
private async Task <bool> PrepareImageAsync(DockerImageId imageId, DockerClient dockerClient) { using var loggerScope = _logger.BeginScope($"Preparing image {imageId.FullName}"); if (_imageSourceManager.IsInternalImage(imageId)) { var source = _imageSourceManager.Get(imageId); return(await BuildImageSourceAsync(imageId, source.Directory, dockerClient)); } return(await DownloadImageAsync(imageId, dockerClient)); }