From 6cc12c04631d9832d51d24eeabeaa7521ae3600f Mon Sep 17 00:00:00 2001 From: Eric Schrock Date: Mon, 25 Nov 2019 10:52:05 -0500 Subject: [PATCH 1/2] dynamic provider factory (#110) --- .../getting-started/GettingStartedTests.yml | 4 +-- .../remotes/s3/s3WorkflowTests.yml | 4 +-- src/main/kotlin/io/titandata/titan/Cli.kt | 8 +---- .../kotlin/io/titandata/titan/Dependencies.kt | 4 +-- .../io/titandata/titan/commands/Abort.kt | 2 +- .../io/titandata/titan/commands/Checkout.kt | 2 +- .../io/titandata/titan/commands/Clone.kt | 2 +- .../io/titandata/titan/commands/Commit.kt | 2 +- .../kotlin/io/titandata/titan/commands/Cp.kt | 2 +- .../io/titandata/titan/commands/Delete.kt | 2 +- .../io/titandata/titan/commands/Install.kt | 2 +- .../io/titandata/titan/commands/List.kt | 10 ++++-- .../kotlin/io/titandata/titan/commands/Log.kt | 2 +- .../io/titandata/titan/commands/Migrate.kt | 2 +- .../io/titandata/titan/commands/Pull.kt | 2 +- .../io/titandata/titan/commands/Push.kt | 2 +- .../io/titandata/titan/commands/Remote.kt | 8 ++--- .../io/titandata/titan/commands/Remove.kt | 2 +- .../kotlin/io/titandata/titan/commands/Run.kt | 2 +- .../io/titandata/titan/commands/Start.kt | 2 +- .../io/titandata/titan/commands/Status.kt | 2 +- .../io/titandata/titan/commands/Stop.kt | 2 +- .../kotlin/io/titandata/titan/commands/Tag.kt | 2 +- .../io/titandata/titan/commands/Uninstall.kt | 5 +-- .../io/titandata/titan/commands/Upgrade.kt | 3 +- .../titandata/titan/providers/Kubernetes.kt | 1 - .../io/titandata/titan/providers/Local.kt | 1 - .../titan/providers/ProviderFactory.kt | 31 +++++++++++++++++-- .../io/titandata/titan/DependenciesTest.kt | 17 ---------- .../titan/providers/ProviderFactoryTest.kt | 23 -------------- 30 files changed, 70 insertions(+), 83 deletions(-) delete mode 100644 src/test/kotlin/io/titandata/titan/DependenciesTest.kt delete mode 100644 src/test/kotlin/io/titandata/titan/providers/ProviderFactoryTest.kt diff --git a/src/endtoend-test/getting-started/GettingStartedTests.yml b/src/endtoend-test/getting-started/GettingStartedTests.yml index b0b0964e..761a4b76 100644 --- a/src/endtoend-test/getting-started/GettingStartedTests.yml +++ b/src/endtoend-test/getting-started/GettingStartedTests.yml @@ -4,7 +4,7 @@ tests: wait: 10 stdout: contains: Titan cli successfully installed, happy data versioning :) - - "can clone hello-world/posrgres": + - "can clone hello-world/postgres": command: titan clone -n hello-world s3web://demo.titan-data.io/hello-world/postgres stdout: contains: @@ -85,4 +85,4 @@ tests: stdout: contains: Uninstalled titan infrastructure after: - clearVars: true \ No newline at end of file + clearVars: true diff --git a/src/endtoend-test/remotes/s3/s3WorkflowTests.yml b/src/endtoend-test/remotes/s3/s3WorkflowTests.yml index 9fbffb6e..82b3f146 100644 --- a/src/endtoend-test/remotes/s3/s3WorkflowTests.yml +++ b/src/endtoend-test/remotes/s3/s3WorkflowTests.yml @@ -19,7 +19,7 @@ tests: wait: 30 stdout: contains: Titan cli successfully installed, happy data versioning :) - - "can clone hello-world/posrgres": + - "can clone hello-world/postgres": command: titan clone -n hello-world s3web://demo.titan-data.io/hello-world/postgres stdout: contains: @@ -37,4 +37,4 @@ files: URI: s3://titan-data-testdata/e2etest REPO: hello-world after: - clearVars: true \ No newline at end of file + clearVars: true diff --git a/src/main/kotlin/io/titandata/titan/Cli.kt b/src/main/kotlin/io/titandata/titan/Cli.kt index 57b75793..ae41707f 100644 --- a/src/main/kotlin/io/titandata/titan/Cli.kt +++ b/src/main/kotlin/io/titandata/titan/Cli.kt @@ -43,13 +43,7 @@ object Cli { class Titan : CliktCommand(help = "Titan CLI") { override fun run() { - val providerFactory = ProviderFactory() - val type = System.getenv("TITAN_CONTEXT") ?: "local" - val provider = providerFactory.getFactory(type) - context.obj = Dependencies(provider) - if (context.invokedSubcommand?.commandName != "install") { - provider.checkInstall() - } + context.obj = Dependencies(ProviderFactory()) } } diff --git a/src/main/kotlin/io/titandata/titan/Dependencies.kt b/src/main/kotlin/io/titandata/titan/Dependencies.kt index 392d0db0..ffcf0df0 100644 --- a/src/main/kotlin/io/titandata/titan/Dependencies.kt +++ b/src/main/kotlin/io/titandata/titan/Dependencies.kt @@ -1,5 +1,5 @@ package io.titandata.titan -import io.titandata.titan.providers.Provider +import io.titandata.titan.providers.ProviderFactory -data class Dependencies(val provider: Provider) +data class Dependencies(val providers: ProviderFactory) diff --git a/src/main/kotlin/io/titandata/titan/commands/Abort.kt b/src/main/kotlin/io/titandata/titan/commands/Abort.kt index a230232c..878c7e90 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Abort.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Abort.kt @@ -17,7 +17,7 @@ class Abort : CliktCommand(help = "Abort current push or pull operation") { private val dependencies: Dependencies by requireObject() private val repository: String by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.abort(repository) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Checkout.kt b/src/main/kotlin/io/titandata/titan/commands/Checkout.kt index ad0f3c0a..fe6f8a23 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Checkout.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Checkout.kt @@ -21,7 +21,7 @@ class Checkout : CliktCommand(help = "Checkout a specific commit") { private val commit by option("-c", "--commit", help = "Commit to checkout") private val tags by option("-t", "--tag", help = "Tag to filter latest commit, if commit is not specified").multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.checkout(repository, commit, tags) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Clone.kt b/src/main/kotlin/io/titandata/titan/commands/Clone.kt index f050bd97..008ab22a 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Clone.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Clone.kt @@ -28,7 +28,7 @@ class Clone : CliktCommand(help = "Clone a remote repository to local repository private val arguments by argument().multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepositoryName(repository) val params = mutableMapOf() for (param in parameters) { val split = param.split("=") diff --git a/src/main/kotlin/io/titandata/titan/commands/Commit.kt b/src/main/kotlin/io/titandata/titan/commands/Commit.kt index ab0735e8..a486f12d 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Commit.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Commit.kt @@ -22,7 +22,7 @@ class Commit : CliktCommand(help = "Commit current data state") { private val message by option("-m", "--message", help = "Commit message").default("") private val tags by option("-t", "--tag", help = "Tag to set").multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.commit(repository, message, tags) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Cp.kt b/src/main/kotlin/io/titandata/titan/commands/Cp.kt index 7b31754e..8bab471e 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Cp.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Cp.kt @@ -25,7 +25,7 @@ class Cp : CliktCommand( private val source by option("-s", "--source", help = "Required. Source location of the files on the local machine").required() private val destination by option("-d", "--destination", help = "Destination of the files inside of the container").default("") override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.cp(repository, "local", source, destination) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Delete.kt b/src/main/kotlin/io/titandata/titan/commands/Delete.kt index 80408123..a62f1ba6 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Delete.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Delete.kt @@ -23,7 +23,7 @@ class Delete : CliktCommand( private val commit by option("-c", "--commit", help = "Commit GUID to delete") private val tags by option("-t", "--tag", help = "Tags to remove from a commit").multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.delete(repository, commit, tags) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Install.kt b/src/main/kotlin/io/titandata/titan/commands/Install.kt index 32c1353b..473180d8 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Install.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Install.kt @@ -19,7 +19,7 @@ class Install : CliktCommand(help = "Install titan infrastructure") { private val registry by option("-r", "--registry", help = "Registry URL for titan docker image, defaults to titandata") private val verbose by option("-V", "--verbose", help = "Verbose output of Titan Server installation steps.").flag(default = false) override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.default(false) provider.install(registry, verbose) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/List.kt b/src/main/kotlin/io/titandata/titan/commands/List.kt index 4acf8c5d..006d123a 100644 --- a/src/main/kotlin/io/titandata/titan/commands/List.kt +++ b/src/main/kotlin/io/titandata/titan/commands/List.kt @@ -14,9 +14,15 @@ import org.kodein.di.generic.provider class List : CliktCommand(help = "List repositories", name = "ls") { private val dependencies: Dependencies by requireObject() + private val n = System.lineSeparator() + override fun run() { - val provider = dependencies.provider - provider.list() + // Check that we have at least one context installed + dependencies.providers.default() + System.out.printf("%-20s %s$n", "REPOSITORY", "STATUS") + for (provider in dependencies.providers.list()) { + provider.list() + } } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Log.kt b/src/main/kotlin/io/titandata/titan/commands/Log.kt index 9d27a6ff..e728f9db 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Log.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Log.kt @@ -20,7 +20,7 @@ class Log : CliktCommand(help = "List commits for a repository") { private val repository by argument() private val tags by option("-t", "--tag", help = "Tag to set").multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.log(repository, tags) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Migrate.kt b/src/main/kotlin/io/titandata/titan/commands/Migrate.kt index 680d95a2..00b04a4c 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Migrate.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Migrate.kt @@ -25,7 +25,7 @@ class Migrate : CliktCommand( private val repository by argument() private val source by option("-s", "--source", help = "Required. Source docker database container").required() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.default() provider.migrate(source, repository) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Pull.kt b/src/main/kotlin/io/titandata/titan/commands/Pull.kt index dac63fb2..4f62d073 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Pull.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Pull.kt @@ -25,7 +25,7 @@ class Pull : CliktCommand(help = "Pull a new data state from remote") { private val repository by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.pull(repository, commit, remote, tags, metadataOnly) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Push.kt b/src/main/kotlin/io/titandata/titan/commands/Push.kt index c4e5a7f5..993f04ee 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Push.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Push.kt @@ -25,7 +25,7 @@ class Push : CliktCommand(help = "Push data state to remote") { private val repository: String by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.push(repository, commit, remote, tags, metadataOnly) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Remote.kt b/src/main/kotlin/io/titandata/titan/commands/Remote.kt index 51c5fe1e..ef650b73 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Remote.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Remote.kt @@ -29,7 +29,7 @@ class RemoteAdd : CliktCommand(help = "Set remote destination for a repository", private val repository: String by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) val params = mutableMapOf() for (param in parameters) { val split = param.split("=") @@ -49,7 +49,7 @@ class RemoteLog : CliktCommand(help = "Display log on remote", name = "log") { private val tags by option("-t", "--tag", help = "Tag to set").multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.remoteLog(repository, remote, tags) } } @@ -59,7 +59,7 @@ class RemoteList : CliktCommand(help = "List remotes for a repository", name = " private val repository: String by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.remoteList(repository) } } @@ -70,7 +70,7 @@ class RemoteRemove : CliktCommand(help = "Remove remote from a repository", name private val remote: String by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.remoteRemove(repository, remote) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Remove.kt b/src/main/kotlin/io/titandata/titan/commands/Remove.kt index c9d748c9..b8db1685 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Remove.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Remove.kt @@ -20,7 +20,7 @@ class Remove : CliktCommand(help = "Remove a repository", name = "rm") { private val dependencies: Dependencies by requireObject() private val repository by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.remove(repository, force) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Run.kt b/src/main/kotlin/io/titandata/titan/commands/Run.kt index cf90b14c..de8aad55 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Run.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Run.kt @@ -30,7 +30,7 @@ class Run : CliktCommand( private val repository by option("-n", "--name", help = "Optional new name for repository.") private val arguments by argument().multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepositoryName(repository) provider.run(image, repository, environments, arguments, disablePortMapping) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Start.kt b/src/main/kotlin/io/titandata/titan/commands/Start.kt index 24ea13bd..4a45e198 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Start.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Start.kt @@ -17,7 +17,7 @@ class Start : CliktCommand(help = "Start a container for a repository") { private val dependencies: Dependencies by requireObject() private val repository by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.start(repository) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Status.kt b/src/main/kotlin/io/titandata/titan/commands/Status.kt index 4a300065..4a269f48 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Status.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Status.kt @@ -18,7 +18,7 @@ class Status : CliktCommand(help = "Display current status for a repository") { private val repository: String by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.status(repository) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Stop.kt b/src/main/kotlin/io/titandata/titan/commands/Stop.kt index 92f54cfb..b2e53a9d 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Stop.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Stop.kt @@ -17,7 +17,7 @@ class Stop : CliktCommand(help = "Stop a running container for a repository") { private val dependencies: Dependencies by requireObject() private val repository by argument() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.stop(repository) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Tag.kt b/src/main/kotlin/io/titandata/titan/commands/Tag.kt index 940a0821..99a20704 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Tag.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Tag.kt @@ -24,7 +24,7 @@ class Tag : CliktCommand( private val commit by option("-c", "--commit", help = "Commit GUID to tag").required() private val tags by option("-t", "--tag", help = "Tags to add").multiple() override fun run() { - val provider = dependencies.provider + val provider = dependencies.providers.byRepository(repository) provider.tag(repository, commit, tags) } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Uninstall.kt b/src/main/kotlin/io/titandata/titan/commands/Uninstall.kt index cb28a874..ea123660 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Uninstall.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Uninstall.kt @@ -18,8 +18,9 @@ class Uninstall : CliktCommand(help = "Uninstall titan infrastructure") { private val force by option("-f", "--force", help = "Destroy all repositories").flag(default = false) private val dependencies: Dependencies by requireObject() override fun run() { - val provider = dependencies.provider - provider.uninstall(force) + for (provider in dependencies.providers.list()) { + provider.uninstall(force) + } } } diff --git a/src/main/kotlin/io/titandata/titan/commands/Upgrade.kt b/src/main/kotlin/io/titandata/titan/commands/Upgrade.kt index 1024acb5..6bef2820 100644 --- a/src/main/kotlin/io/titandata/titan/commands/Upgrade.kt +++ b/src/main/kotlin/io/titandata/titan/commands/Upgrade.kt @@ -22,7 +22,8 @@ class Upgrade : CliktCommand(help = "Upgrade titan CLI and infrastructure") { private val finalize by option("--finalize").flag(default = false) private val path by option("-p", "--path", help = "Full installation path of Titan").default("") override fun run() { - val provider = dependencies.provider + // TODO This command is not really provider-specific + val provider = dependencies.providers.default() provider.upgrade(force, version, finalize, path) } diff --git a/src/main/kotlin/io/titandata/titan/providers/Kubernetes.kt b/src/main/kotlin/io/titandata/titan/providers/Kubernetes.kt index c2482887..367b7ecd 100644 --- a/src/main/kotlin/io/titandata/titan/providers/Kubernetes.kt +++ b/src/main/kotlin/io/titandata/titan/providers/Kubernetes.kt @@ -195,7 +195,6 @@ class Kubernetes : Provider { } override fun list() { - System.out.printf("%-20s %s$n", "REPOSITORY", "STATUS") for (container in getRuntimeStatus()) { System.out.printf("%-20s %s$n", container.name, container.status) } diff --git a/src/main/kotlin/io/titandata/titan/providers/Local.kt b/src/main/kotlin/io/titandata/titan/providers/Local.kt index b492e386..6ce312d1 100644 --- a/src/main/kotlin/io/titandata/titan/providers/Local.kt +++ b/src/main/kotlin/io/titandata/titan/providers/Local.kt @@ -163,7 +163,6 @@ class Local : Provider { } override fun list() { - System.out.printf("%-20s %s$n", "REPOSITORY", "STATUS") for (container in getContainersStatus()) { System.out.printf("%-20s %s$n", container.name, container.status) } diff --git a/src/main/kotlin/io/titandata/titan/providers/ProviderFactory.kt b/src/main/kotlin/io/titandata/titan/providers/ProviderFactory.kt index 4d77920e..4c92a171 100644 --- a/src/main/kotlin/io/titandata/titan/providers/ProviderFactory.kt +++ b/src/main/kotlin/io/titandata/titan/providers/ProviderFactory.kt @@ -1,11 +1,38 @@ package io.titandata.titan.providers class ProviderFactory { - fun getFactory(name: String): Provider { - return when (name) { + + private val provider: Provider + + init { + val type = System.getenv("TITAN_CONTEXT") ?: "local" + provider = when (type) { "local" -> Local() "kubernetes" -> Kubernetes() else -> Mock() } } + + fun list(): List { + return listOf(provider) + } + + fun byRepositoryName(repoName: String?): Provider { + if (repoName == null) { + return default() + } else { + return provider + } + } + + fun byRepository(repoName: String): Provider { + return provider + } + + fun default(checkInstall: Boolean = true): Provider { + if (checkInstall) { + provider.checkInstall() + } + return provider + } } diff --git a/src/test/kotlin/io/titandata/titan/DependenciesTest.kt b/src/test/kotlin/io/titandata/titan/DependenciesTest.kt deleted file mode 100644 index 6ec26dbe..00000000 --- a/src/test/kotlin/io/titandata/titan/DependenciesTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.titandata.titan - -import io.titandata.titan.providers.Provider -import io.titandata.titan.providers.ProviderFactory -import org.hamcrest.CoreMatchers.instanceOf -import org.junit.Assert.assertThat -import org.junit.Test - -class DependenciesTest { - val provider = ProviderFactory().getFactory("mock") - val dependencies = Dependencies(provider) - - @Test - fun `can get provider`() { - assertThat(dependencies.provider, instanceOf(Provider::class.java)) - } -} diff --git a/src/test/kotlin/io/titandata/titan/providers/ProviderFactoryTest.kt b/src/test/kotlin/io/titandata/titan/providers/ProviderFactoryTest.kt deleted file mode 100644 index 46685665..00000000 --- a/src/test/kotlin/io/titandata/titan/providers/ProviderFactoryTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -package io.titandata.titan.providers - -import org.junit.Test - -class ProviderFactoryTest { - val providerFactory = ProviderFactory() - - @Test - fun `can get mock provider`() { - val provider = providerFactory.getFactory("mock") - // TODO test without reflection or add reflection to dev dependencies only - // assertThat(provider, instanceOf(Provider::class.java)) - // assertEquals("io.titandata.titan.providers.Mock", provider::class.qualifiedName) - } - - @Test - fun `can get local provider`() { - val provider = providerFactory.getFactory("local") - // TODO test without reflection or add reflection to dev dependencies only - // assertThat(provider, instanceOf(Provider::class.java)) - // assertEquals("io.titandata.titan.providers.Local", provider::class.qualifiedName) - } -} From 9302eb4589499be46d48dba3a2f7d8783a845228 Mon Sep 17 00:00:00 2001 From: Derek Smart Date: Mon, 25 Nov 2019 11:00:40 -0500 Subject: [PATCH 2/2] move docker build to runner not tester (#114) --- .github/workflows/end-to-end-test.yml | 3 +++ src/endtoend-test/context/docker/DockerTests.yml | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/end-to-end-test.yml b/.github/workflows/end-to-end-test.yml index 2a418e78..b21ced01 100644 --- a/.github/workflows/end-to-end-test.yml +++ b/.github/workflows/end-to-end-test.yml @@ -64,5 +64,8 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: ${{ secrets.AWS_REGION }} + - name: Build Nginx Docker Container + working-directory: ./src/endtoend-test/context/docker + run: docker build -t nginx-test . - name: Run Docker Context Tests run: java -jar vexrun.jar -d ./src/endtoend-test/context/docker \ No newline at end of file diff --git a/src/endtoend-test/context/docker/DockerTests.yml b/src/endtoend-test/context/docker/DockerTests.yml index b03a5866..defbc9fd 100644 --- a/src/endtoend-test/context/docker/DockerTests.yml +++ b/src/endtoend-test/context/docker/DockerTests.yml @@ -2,8 +2,6 @@ tests: - "can install titan": command: titan install wait: 10 - - "can build nginx-test": - command: cd src/endtoend-test/context/docker && docker build -t nginx-test -f ./src/endtoend-test/context/docker/Dockerfile . - "can run nginx-test": command: titan run nginx-test - "can remove nginx-test":