From 4b9cba492d1b5f76c80ef15a68d5d16e03ddca1b Mon Sep 17 00:00:00 2001 From: Maciej Kwidzinski Date: Fri, 23 Apr 2021 18:47:38 +0200 Subject: [PATCH] WIP: Try mounting shared home It fails due to: ``` 2021-04-23T16:36:59,942Z DEBUG Test worker [] [com.atlassian.performance.tools.ssh.SshjConnection] root$ sudo service nfs-kernel-server restart 2021-04-23T16:37:00,977Z DEBUG Test worker [] [com.atlassian.performance.tools.ssh.WaitingCommand.Companion] * Stopping NFS kernel daemon ...done. * Unexporting directories for NFS kernel daemon... ...done. * Exporting directories for NFS kernel daemon... ...fail! 2021-04-23T16:37:00,979Z WARN Test worker [] [com.atlassian.performance.tools.ssh.WaitingCommand.Companion] exportfs: /home/ubuntu/jira-shared-home does not support NFS export ``` Options: * keep trying NFS in Docker (in WSL) * try other FS sharing (FUSE? SAN?) * use different FS sharing in Docker (volumes?) and different in AWS (so SPI, but what is default? maybe no default or maybe bound to `Infrastructure` SPI itself) --- .../infrastructure/api/Infrastructure.kt | 10 ++- .../api/database/DockerMysqlServer.kt | 2 +- .../api/jira/install/hook/DataCenterHook.kt | 26 -------- .../api/jira/instance/JiraDataCenterPlan.kt | 2 +- .../api/jira/instance/JiraServerPlan.kt | 2 +- .../api/jira/instance/SharedHomeHook.kt | 62 +++++++++++++++++++ .../infrastructure/api/jira/report/Reports.kt | 2 +- .../api/loadbalancer/ApacheProxyPlan.kt | 5 +- .../api/DockerInfrastructure.kt | 31 ++++++++-- .../infrastructure/api/browser/ChromeIT.kt | 2 +- .../api/browser/chromium/Chromium69IT.kt | 2 +- .../chromium/PageLoadTimeoutRecoveryTest.kt | 2 +- .../api/dataset/HttpDatasetPackageIT.kt | 2 +- .../PublicJiraServiceDeskDistributionIT.kt | 2 +- .../PublicJiraSoftwareDistributionsIT.kt | 2 +- .../infrastructure/api/docker/DockerIT.kt | 2 +- .../api/jira/instance/JiraDataCenterPlanIT.kt | 13 ++-- .../api/jvm/AdoptOpenJdk11IT.kt | 2 +- .../infrastructure/api/jvm/AdoptOpenJdkIT.kt | 2 +- .../infrastructure/api/jvm/OpenJdk11IT.kt | 2 +- .../tools/infrastructure/api/jvm/OpenJdkIT.kt | 2 +- .../infrastructure/api/jvm/OracleJdkIT.kt | 2 +- .../tools/infrastructure/api/os/UbuntuIT.kt | 10 +-- 23 files changed, 126 insertions(+), 63 deletions(-) delete mode 100644 src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/install/hook/DataCenterHook.kt create mode 100644 src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/SharedHomeHook.kt diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/Infrastructure.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/Infrastructure.kt index f01ba8b2..7fb7c99a 100644 --- a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/Infrastructure.kt +++ b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/Infrastructure.kt @@ -1,11 +1,15 @@ package com.atlassian.performance.tools.infrastructure.api import com.atlassian.performance.tools.infrastructure.api.jira.install.TcpHost +import com.atlassian.performance.tools.ssh.api.Ssh + +interface Infrastructure : AutoCloseable { // TODO rename to ServerRoom + + val subnet: String -interface Infrastructure : AutoCloseable { - /** * @return can be reached by the caller via [TcpHost.publicIp] and by the rest of the infra via [TcpHost.privateIp] */ - fun serve(port: Int, name: String): TcpHost + fun serveTcp(name: String): TcpHost + fun serveSsh(name: String): Ssh } \ No newline at end of file diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/database/DockerMysqlServer.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/database/DockerMysqlServer.kt index 75cb01d3..232ab29e 100644 --- a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/database/DockerMysqlServer.kt +++ b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/database/DockerMysqlServer.kt @@ -28,7 +28,7 @@ class DockerMysqlServer private constructor( hooks: PreInstanceHooks, reports: Reports ) { - val server = infrastructure.serve(3306, "mysql") + val server = infrastructure.serveTcp("mysql") val client = server.ssh.newConnection().use { setup(it, server) } nodes.forEach { node -> node.postInstall.insert(DatabaseIpConfig(server.privateIp)) diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/install/hook/DataCenterHook.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/install/hook/DataCenterHook.kt deleted file mode 100644 index 5ec19a6d..00000000 --- a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/install/hook/DataCenterHook.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.atlassian.performance.tools.infrastructure.api.jira.install.hook - -import com.atlassian.performance.tools.infrastructure.api.jira.SharedHome -import com.atlassian.performance.tools.infrastructure.api.jira.install.InstalledJira -import com.atlassian.performance.tools.infrastructure.api.jira.report.Reports -import com.atlassian.performance.tools.ssh.api.SshConnection - -class DataCenterHook( - private val nodeId: String, - private val sharedHome: SharedHome -) : PostInstallHook { - - override fun call( - ssh: SshConnection, - jira: InstalledJira, - hooks: PostInstallHooks, - reports: Reports - ) { - val localSharedHome = sharedHome.localSharedHome - sharedHome.mount(ssh) - val jiraHome = jira.home.path // TODO what's the difference between localSharedHome and jiraHome? should both be hookable? - ssh.execute("echo ehcache.object.port = 40011 >> $jiraHome/cluster.properties") - ssh.execute("echo jira.node.id = $nodeId >> $jiraHome/cluster.properties") - ssh.execute("echo jira.shared.home = `realpath $localSharedHome` >> $jiraHome/cluster.properties") - } -} diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlan.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlan.kt index 8efbaa8f..0d1d926c 100644 --- a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlan.kt +++ b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlan.kt @@ -27,7 +27,7 @@ class JiraDataCenterPlan constructor( instanceHooks.call(nodePlans.map { it.hooks }, reports) val nodes = nodePlans.mapIndexed { nodeIndex, nodePlan -> val nodeNumber = nodeIndex + 1 - val host = infrastructure.serve(8080, "jira-node-$nodeNumber") + val host = infrastructure.serveTcp("jira-node-$nodeNumber") nodePlan.materialize(host) } val balancer = balancerPlan.materialize(nodes) diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraServerPlan.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraServerPlan.kt index 322c0034..c9d7da75 100644 --- a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraServerPlan.kt +++ b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraServerPlan.kt @@ -17,7 +17,7 @@ class JiraServerPlan private constructor( override fun materialize(): JiraInstance { val nodeHooks = listOf(plan).map { it.hooks } hooks.call(nodeHooks, reports) - val jiraNode = infrastructure.serve(8080, "jira-node") + val jiraNode = infrastructure.serveTcp("jira-node") val installed = plan.installation.install(jiraNode, reports) val started = plan.start.start(installed, reports) val instance = JiraServer(started) diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/SharedHomeHook.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/SharedHomeHook.kt new file mode 100644 index 00000000..17f79860 --- /dev/null +++ b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/SharedHomeHook.kt @@ -0,0 +1,62 @@ +package com.atlassian.performance.tools.infrastructure.api.jira.instance + +import com.atlassian.performance.tools.infrastructure.api.Infrastructure +import com.atlassian.performance.tools.infrastructure.api.jira.JiraHomeSource +import com.atlassian.performance.tools.infrastructure.api.jira.install.InstalledJira +import com.atlassian.performance.tools.infrastructure.api.jira.install.hook.PostInstallHook +import com.atlassian.performance.tools.infrastructure.api.jira.install.hook.PostInstallHooks +import com.atlassian.performance.tools.infrastructure.api.jira.install.hook.PreInstallHooks +import com.atlassian.performance.tools.infrastructure.api.jira.report.Reports +import com.atlassian.performance.tools.infrastructure.api.os.RemotePath +import com.atlassian.performance.tools.infrastructure.api.os.Ubuntu +import com.atlassian.performance.tools.ssh.api.SshConnection + +internal class SharedHomeHook( + private val jiraHomeSource: JiraHomeSource, + private val infrastructure: Infrastructure +) : PreInstanceHook { + private val localHome = "/home/ubuntu/jira-shared-home" + + override fun call(nodes: List, hooks: PreInstanceHooks, reports: Reports) { + val server = infrastructure.serveSsh("shared-home") + server.newConnection().use { ssh -> + download(ssh) + export(ssh) + } + val sharedHome = RemotePath(server.host, localHome) + nodes.forEach { it.postInstall.insert(SharedHomeMount(sharedHome)) } + } + + private fun download(ssh: SshConnection) { + ssh.execute("sudo mkdir -p $localHome") + val jiraHome = jiraHomeSource.download(ssh) + ssh.execute("sudo mv $jiraHome/{data,plugins,import,export} $localHome") + ssh.safeExecute("sudo mv $jiraHome/logos $localHome") + } + + private fun export(ssh: SshConnection): SshConnection.SshResult { + Ubuntu().install(ssh, listOf("nfs-kernel-server")) + val options = "rw,sync,no_subtree_check,no_root_squash" + ssh.execute("sudo echo '$localHome ${infrastructure.subnet}($options)' | sudo tee -a /etc/exports") + return ssh.execute("sudo service nfs-kernel-server restart") + } + + private class SharedHomeMount( + private val sharedHome: RemotePath + ) : PostInstallHook { + + override fun call(ssh: SshConnection, jira: InstalledJira, hooks: PostInstallHooks, reports: Reports) { + Ubuntu().install(ssh, listOf("nfs-common")) + val mountSource = "${sharedHome.host.ipAddress}:${sharedHome.path}" + val mountTarget = "mounted-shared-home" + ssh.execute("mkdir -p $mountTarget") + ssh.execute("sudo mount -o soft,intr,rsize=8192,wsize=8192 $mountSource $mountTarget") + ssh.execute("sudo chown ubuntu:ubuntu $mountTarget") + val mountedPath = "`realpath $mountTarget`" + val jiraHome = jira.home.path + ssh.execute("echo ehcache.object.port = 40011 >> $jiraHome/cluster.properties") + ssh.execute("echo jira.node.id = ${jira.host.name} >> $jiraHome/cluster.properties") + ssh.execute("echo jira.shared.home = $mountedPath >> $jiraHome/cluster.properties") + } + } +} diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/report/Reports.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/report/Reports.kt index 1a579e41..84aa3ae9 100644 --- a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/report/Reports.kt +++ b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/report/Reports.kt @@ -10,7 +10,7 @@ import java.nio.file.Paths import java.util.* import java.util.concurrent.ConcurrentLinkedQueue -class Reports private constructor( +class Reports private constructor( // TODO turn into SPI to allow AWS CLI transport (S3) private val hostReports: Queue ) { constructor() : this(ConcurrentLinkedQueue()) diff --git a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/loadbalancer/ApacheProxyPlan.kt b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/loadbalancer/ApacheProxyPlan.kt index 4d4b9578..6588dddc 100644 --- a/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/loadbalancer/ApacheProxyPlan.kt +++ b/src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/loadbalancer/ApacheProxyPlan.kt @@ -15,20 +15,19 @@ import java.net.URI import java.time.Duration class ApacheProxyPlan( - private val httpPort: Int, private val infrastructure: Infrastructure ) : LoadBalancerPlan { private val configPath = "/etc/apache2/sites-enabled/000-default.conf" override fun materialize(nodes: List): LoadBalancer { - val proxyNode = infrastructure.serve(httpPort, "apache-proxy") + val proxyNode = infrastructure.serveTcp("apache-proxy") IdempotentAction("Installing and configuring apache load balancer") { proxyNode.ssh.newConnection().use { connection -> tryToProvision(connection, nodes) } }.retry(2, ExponentialBackoff(Duration.ofSeconds(5))) - val balancerEndpoint = URI("http://${proxyNode.privateIp}:$httpPort/") + val balancerEndpoint = URI("http://${proxyNode.privateIp}:${proxyNode.port}/") nodes.forEach { it.plan.hooks.preStart.insert(InjectProxy(balancerEndpoint)) } return ApacheProxy(balancerEndpoint) } diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/DockerInfrastructure.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/DockerInfrastructure.kt index 297f12e5..463979ca 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/DockerInfrastructure.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/DockerInfrastructure.kt @@ -26,6 +26,7 @@ internal class DockerInfrastructure : Infrastructure { private val allocatedResources: Deque = ConcurrentLinkedDeque() private val docker: DockerClient private val network: DockerNetwork + override val subnet: String init { val dockerConfig = DefaultDockerClientConfig.createDefaultConfigBuilder().build() @@ -37,17 +38,37 @@ internal class DockerInfrastructure : Infrastructure { .withName(randomUUID().toString()) .execAsResource(docker) allocatedResources.add(network) + subnet = docker + .inspectNetworkCmd() + .withNetworkId(network.response.id) + .exec() + .ipam + .config + .first() + .subnet + } + + fun serveTest(): Ssh { + return serveSsh("ssh") } - fun serve(): Ssh { - return serve("ssh") + override fun serveSsh(name: String): Ssh { + return serveTcp(888, name).ssh } - fun serve(name: String): Ssh { - return serve(888, name).ssh + + override fun serveTcp(name: String): TcpHost { + return when { + name.startsWith("jira-node") -> serveTcp(8080, name) // TODO this is a contract on undocumented behavior + name.startsWith("mysql") -> serveTcp(3306, name) + else -> serveTcp( + 888, + name + ) // TODO pre-provision all the hosts rather than on-demand - unlock batch provisioning (CFN Stack), picking EC2 types, SSD storage, TCP port ranges, subnets, etc. + } } - override fun serve(port: Int, name: String): TcpHost { + private fun serveTcp(port: Int, name: String): TcpHost { docker .pullImageCmd("rastasheep/ubuntu-sshd") .withTag("18.04") diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/ChromeIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/ChromeIT.kt index e6f87435..383b8791 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/ChromeIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/ChromeIT.kt @@ -12,7 +12,7 @@ class ChromeIT { @Test fun shouldInstallChromeBrowser() { DockerInfrastructure().use { infra -> - infra.serve(80, "ChromeIT").ssh.newConnection().use { connection -> + infra.serveSsh("ChromeIT").newConnection().use { connection -> val wasInstalledBefore = isChromeInstalled(connection) Chrome().install(connection) diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/Chromium69IT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/Chromium69IT.kt index 0766022d..331a9c45 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/Chromium69IT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/Chromium69IT.kt @@ -14,7 +14,7 @@ class Chromium69IT { @Test fun shouldInstallBrowser() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> val installedBefore = isChromiumInstalled(connection) Chromium69().install(connection) diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/PageLoadTimeoutRecoveryTest.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/PageLoadTimeoutRecoveryTest.kt index b66f47e2..6ee7cb83 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/PageLoadTimeoutRecoveryTest.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/browser/chromium/PageLoadTimeoutRecoveryTest.kt @@ -20,7 +20,7 @@ internal class PageLoadTimeoutRecoveryTest { val fastResource = httpServer.register(FastResponse()) val slowResource = httpServer.register(SlowResponse()) DockerInfrastructure().use { infra -> - val ssh = infra.serve() + val ssh = infra.serveTest() ssh.forwardRemotePort(httpServer.getPort(), httpServer.getPort()).use { val localChromedriverPort = findFreePort() ssh.forwardLocalPort(localChromedriverPort, remoteChromedriverPort).use { diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/dataset/HttpDatasetPackageIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/dataset/HttpDatasetPackageIT.kt index 1c307690..0281cb58 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/dataset/HttpDatasetPackageIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/dataset/HttpDatasetPackageIT.kt @@ -21,7 +21,7 @@ class HttpDatasetPackageIT { ) val filesInDataset = DockerInfrastructure().use { infra -> - val ssh = infra.serve(80, "HttpDatasetPackageIT").ssh + val ssh = infra.serveSsh("HttpDatasetPackageIT") return@use RandomFilesGenerator(ssh).start().use { ssh.newConnection().use { connection -> val unpackedPath = dataset.download(connection) diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraServiceDeskDistributionIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraServiceDeskDistributionIT.kt index c27ec873..d27a0666 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraServiceDeskDistributionIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraServiceDeskDistributionIT.kt @@ -9,7 +9,7 @@ class PublicJiraServiceDeskDistributionIT { @Test fun shouldDownloadJiraServiceDesk() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> val serviceDeskDistribution: ProductDistribution = PublicJiraServiceDeskDistribution("4.0.1") val targetFolder = "test" connection.execute("mkdir $targetFolder") diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraSoftwareDistributionsIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraSoftwareDistributionsIT.kt index 85835229..6dd74c85 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraSoftwareDistributionsIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/distribution/PublicJiraSoftwareDistributionsIT.kt @@ -9,7 +9,7 @@ class PublicJiraSoftwareDistributionsIT { @Test fun shouldDownloadJiraSoftware() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> val jiraDistribution: ProductDistribution = PublicJiraSoftwareDistribution("7.2.0") val targetFolder = "test" connection.execute("mkdir $targetFolder") diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/docker/DockerIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/docker/DockerIT.kt index 11d39785..ecd1f8b5 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/docker/DockerIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/docker/DockerIT.kt @@ -9,7 +9,7 @@ class DockerIT { @Test fun installWorks() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> //workaround for a bug in Docker download site for bionic val packageFile = "containerd.io_1.2.2-3_amd64.deb" Ubuntu().install(connection,listOf( "curl")) diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlanIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlanIT.kt index 690772e4..1be1fc17 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlanIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/JiraDataCenterPlanIT.kt @@ -20,7 +20,6 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.After import org.junit.Before import org.junit.Test -import java.lang.Exception import java.nio.file.Files class JiraDataCenterPlanIT { @@ -40,22 +39,26 @@ class JiraDataCenterPlanIT { @Test fun shouldStartDataCenter() { // given + val jiraHomeSource = JiraHomePackage(Datasets.JiraSevenDataset.jiraHome) val nodePlans = listOf(1, 2).map { + val nodeHooks = PreInstallHooks.default() + .also { Datasets.JiraSevenDataset.hookMysql(it.postStart) } JiraNodePlan.Builder() .installation( ParallelInstallation( - jiraHomeSource = JiraHomePackage(Datasets.JiraSevenDataset.jiraHome), + jiraHomeSource = jiraHomeSource, productDistribution = PublicJiraSoftwareDistribution("7.13.0"), jdk = AdoptOpenJDK() ) ) .start(JiraLaunchScript()) - .hooks(PreInstallHooks.default().also { Datasets.JiraSevenDataset.hookMysql(it.postStart) }) + .hooks(nodeHooks) .build() } val instanceHooks = PreInstanceHooks.default() .also { Datasets.JiraSevenDataset.hookMysql(it, infrastructure) } - val balancerPlan = ApacheProxyPlan(80, infrastructure) + .also { it.insert(SharedHomeHook(jiraHomeSource, infrastructure)) } + val balancerPlan = ApacheProxyPlan(infrastructure) val dcPlan = JiraDataCenterPlan(nodePlans, instanceHooks, balancerPlan, infrastructure) // when @@ -96,7 +99,7 @@ class JiraDataCenterPlanIT { .hooks(PreInstallHooks.default().also { it.preStart.insert(FailingHook()) }) .build() } - val balancerPlan = ApacheProxyPlan(80, infrastructure) + val balancerPlan = ApacheProxyPlan(infrastructure) val dcPlan = JiraDataCenterPlan(nodePlans, PreInstanceHooks.default(), balancerPlan, infrastructure) try { diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdk11IT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdk11IT.kt index 6d29a0cc..d80b4819 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdk11IT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdk11IT.kt @@ -8,7 +8,7 @@ class AdoptOpenJdk11IT { @Test fun shouldSupportJstat() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> JstatSupport(AdoptOpenJDK11()).shouldSupportJstat(connection) } } diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdkIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdkIT.kt index 577de11e..9859470d 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdkIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/AdoptOpenJdkIT.kt @@ -8,7 +8,7 @@ class AdoptOpenJdkIT { @Test fun shouldSupportJstat() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> JstatSupport(AdoptOpenJDK()).shouldSupportJstat(connection) } } diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdk11IT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdk11IT.kt index 73ae5e02..a3370e7c 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdk11IT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdk11IT.kt @@ -8,7 +8,7 @@ class OpenJdk11IT { @Test fun shouldSupportJstat() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> JstatSupport(OpenJDK11()).shouldSupportJstat(connection) } } diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdkIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdkIT.kt index ebb23431..7c05be7d 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdkIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OpenJdkIT.kt @@ -8,7 +8,7 @@ class OpenJdkIT { @Test fun shouldSupportJstat() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> JstatSupport(OpenJDK()).shouldSupportJstat(connection) } } diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OracleJdkIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OracleJdkIT.kt index 0fa2e116..3ce16533 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OracleJdkIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/jvm/OracleJdkIT.kt @@ -8,7 +8,7 @@ class OracleJdkIT { @Test fun shouldSupportJstatAndThreadDumps() { DockerInfrastructure().use { infra -> - infra.serve().newConnection().use { connection -> + infra.serveTest().newConnection().use { connection -> val jdk = OracleJDK() JstatSupport(jdk).shouldSupportJstat(connection) ThreadDumpTest().shouldGatherThreadDump(jdk, connection) diff --git a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/os/UbuntuIT.kt b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/os/UbuntuIT.kt index 6721efcf..78784c32 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/os/UbuntuIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/infrastructure/api/os/UbuntuIT.kt @@ -2,7 +2,7 @@ package com.atlassian.performance.tools.infrastructure.api.os import com.atlassian.performance.tools.infrastructure.api.DockerInfrastructure import com.atlassian.performance.tools.infrastructure.api.Infrastructure -import com.atlassian.performance.tools.infrastructure.api.jira.install.TcpHost +import com.atlassian.performance.tools.ssh.api.Ssh import com.atlassian.performance.tools.ssh.api.SshConnection import com.atlassian.performance.tools.ssh.api.SshHost import org.apache.logging.log4j.Level @@ -18,13 +18,13 @@ import java.util.concurrent.TimeUnit class UbuntuIT { private lateinit var executor: ExecutorService private lateinit var infra: Infrastructure - private lateinit var sshUbuntu: TcpHost + private lateinit var sshUbuntu: Ssh @Before fun before() { executor = Executors.newCachedThreadPool() infra = DockerInfrastructure() - sshUbuntu = infra.serve(80, "UbuntuIT") + sshUbuntu = infra.serveSsh("UbuntuIT") } @After @@ -35,7 +35,7 @@ class UbuntuIT { @Test fun shouldRetry() { - sshUbuntu.ssh.newConnection().use { connection -> + sshUbuntu.newConnection().use { connection -> Ubuntu().install( ColdAptSshConnection(connection), listOf("nano"), @@ -94,7 +94,7 @@ class UbuntuIT { } private fun installLftp(latch: CountDownLatch) { - sshUbuntu.ssh.newConnection().use { connection -> + sshUbuntu.newConnection().use { connection -> latch.countDown() latch.await() Ubuntu().install(connection, listOf("lftp"))