public async Task WordPressDockerComposeServiceShallShowInstallScreen() { var file = Path.Combine(Directory.GetCurrentDirectory(), (TemplateString)"Resources/ComposeTests/WordPress/docker-compose.yml"); using (var svc = new DockerComposeCompositeService(DockerHost, new DockerComposeConfig { ComposeFilePath = new List <string> { file }, ForceRecreate = true, RemoveOrphans = true, StopOnDispose = true })) { svc.Start(); svc.Containers.First(x => x.Name == "wordpress").WaitForHttp("http://localhost:8000/wp-admin/install.php"); // We now have a running WordPress with a MySql database var installPage = await $"http://localhost:8000/wp-admin/install.php".Wget(); Assert.IsTrue(installPage.IndexOf("https://wordpress.org/", StringComparison.Ordinal) != -1); } }
private DockerSetup(IHostService hostService, IList <string> composeFiles) { _dockerSetup = new DockerComposeCompositeService(hostService, new DockerComposeConfig { ComposeFilePath = composeFiles, ForceBuild = true, ForceRecreate = true, RemoveOrphans = true, StopOnDispose = true }); }
public void StartErrorMessageShallContainDockerComposeFilePaths(string[] nonExistentComposeFiles) { var svc = new DockerComposeCompositeService(DockerHost, new DockerComposeConfig { ComposeFilePath = new List <string>(nonExistentComposeFiles), ForceRecreate = true, RemoveOrphans = true, StopOnDispose = true }); var ex = Assert.ThrowsException <FluentDockerException>(() => svc.Start()); foreach (var nonExistentComposeFile in nonExistentComposeFiles) { Assert.IsTrue(ex.Message.Contains(nonExistentComposeFile)); } }
public override ICompositeService Build() { if (_config.ComposeFilePath.Count == 0) { throw new FluentDockerException("Cannot create service without a docker-compose file"); } var host = FindHostService(); if (!host.HasValue) { throw new FluentDockerException( $"Cannot build service using compose-file {_config.ComposeFilePath} since no host service is defined"); } var container = new DockerComposeCompositeService(host.Value, _config); AddHooks(container); return(container); }