Skip to content

Commit

Permalink
Stabilize SshMysqlDatasetPublicationIT
Browse files Browse the repository at this point in the history
Also, centralize the workaround.
  • Loading branch information
dagguh committed Jun 24, 2024
1 parent 87e383b commit 1d4fed9
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.atlassian.performance.tools.awsinfrastructure

import com.atlassian.performance.tools.aws.api.Investment
import com.atlassian.performance.tools.awsinfrastructure.api.InfrastructureFormula
import com.atlassian.performance.tools.awsinfrastructure.api.dataset.DatasetHost
import com.atlassian.performance.tools.awsinfrastructure.api.hardware.C5NineExtraLargeEphemeral
import com.atlassian.performance.tools.awsinfrastructure.api.jira.StandaloneFormula
import com.atlassian.performance.tools.awsinfrastructure.api.virtualusers.AbsentVirtualUsersFormula
import com.atlassian.performance.tools.infrastructure.api.distribution.PublicJiraSoftwareDistribution
import com.atlassian.performance.tools.infrastructure.api.jira.JiraNodeConfig
import com.atlassian.performance.tools.infrastructure.api.jvm.OpenJDK
import com.atlassian.performance.tools.infrastructure.api.jvm.OracleJDK
import java.time.Duration

/**
* The default JDK in [JiraNodeConfig] is flaky to install.
* Currently, it's [OracleJDK] and it's the only one supported by Jira 7. So `infrastructure` cannot just change it,
* it would break all Jira 7 perf tests. It needs a major release.
*/
object FlakyJdkWorkaround {

val STABLE_JDK_CONFIG = JiraNodeConfig.Builder()
.versionedJdk(OpenJDK())
.build()

/**
* avoid unstable default JDK from StandaloneFormula.Builder/JiraNodeConfig.Builder
* TODO update the default DatasetHost after 3.2.0 release
*/
val STABLE_DATASET_HOST = DatasetHost {
InfrastructureFormula
.Builder(
aws = IntegrationTestRuntime.aws,
virtualUsersFormula = AbsentVirtualUsersFormula()
)
.investment(
investment = Investment(
useCase = "Generic purpose dataset modification",
lifespan = Duration.ofMinutes(50)
)
)
.jiraFormula(
StandaloneFormula
.Builder(PublicJiraSoftwareDistribution("8.0.0"), it.jiraHomeSource, it.database)
.config(STABLE_JDK_CONFIG)
.computer(C5NineExtraLargeEphemeral())
.build()
)
.build()
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package com.atlassian.performance.tools.awsinfrastructure.api

import com.amazonaws.regions.Regions
import com.atlassian.performance.tools.aws.api.Investment
import com.atlassian.performance.tools.aws.api.StorageLocation
import com.atlassian.performance.tools.awsinfrastructure.FlakyJdkWorkaround
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime.aws
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime.taskWorkspace
import com.atlassian.performance.tools.awsinfrastructure.api.dataset.DatasetHost
import com.atlassian.performance.tools.awsinfrastructure.api.hardware.C5NineExtraLargeEphemeral
import com.atlassian.performance.tools.awsinfrastructure.api.jira.StandaloneFormula
import com.atlassian.performance.tools.awsinfrastructure.api.virtualusers.AbsentVirtualUsersFormula
import com.atlassian.performance.tools.infrastructure.api.dataset.Dataset
import com.atlassian.performance.tools.infrastructure.api.distribution.PublicJiraSoftwareDistribution
import com.atlassian.performance.tools.infrastructure.api.jira.JiraNodeConfig
import com.atlassian.performance.tools.infrastructure.api.jvm.OpenJDK
import com.atlassian.performance.tools.ssh.api.Ssh
import org.junit.Test
import java.net.URI
Expand All @@ -38,34 +31,11 @@ class AwsDatasetModificationIT {
ssh.execute("rm -r $backupPath")
}
}
// avoid unstable default JDK from StandaloneFormula.Builder/JiraNodeConfig.Builder
// TODO update the default DatasetHost after 3.2.0 release
val stableDatasetHost = DatasetHost {
InfrastructureFormula
.Builder(
aws = aws,
virtualUsersFormula = AbsentVirtualUsersFormula()
)
.investment(
investment = Investment(
useCase = "Generic purpose dataset modification",
lifespan = ofMinutes(50)
)
)
.jiraFormula(
StandaloneFormula
.Builder(PublicJiraSoftwareDistribution("8.0.0"), it.jiraHomeSource, it.database)
.config(JiraNodeConfig.Builder().versionedJdk(OpenJDK()).build())
.computer(C5NineExtraLargeEphemeral())
.build()
)
.build()
}
val modification = AwsDatasetModification.Builder(
aws = aws,
dataset = sourceDataset
)
.host(stableDatasetHost)
.host(FlakyJdkWorkaround.STABLE_DATASET_HOST)
.workspace(workspace)
.onlineTransformation(transformation)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.atlassian.performance.tools.awsinfrastructure.api

import com.atlassian.performance.tools.aws.api.Investment
import com.atlassian.performance.tools.aws.api.SshKeyFormula
import com.atlassian.performance.tools.awsinfrastructure.FlakyJdkWorkaround
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime.aws
import com.atlassian.performance.tools.awsinfrastructure.api.jira.ProvisionedJira
Expand Down Expand Up @@ -49,6 +50,7 @@ class CustomDatasetSourceIT {
jiraHomeSource = sourceDataset.jiraHomeSource,
productDistribution = PublicJiraSoftwareDistribution("9.9.0")
)
.config(FlakyJdkWorkaround.STABLE_JDK_CONFIG)
.build()
.provision(
investment = Investment(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.atlassian.performance.tools.awsinfrastructure.api.dataset

import com.atlassian.performance.tools.awsinfrastructure.FlakyJdkWorkaround
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime
import com.atlassian.performance.tools.awsinfrastructure.api.AwsDatasetModification
import com.atlassian.performance.tools.awsinfrastructure.api.DatasetCatalogue
Expand All @@ -15,7 +16,7 @@ class SshMysqlDatasetPublicationIT {
AwsDatasetModification.Builder(
aws,
DatasetCatalogue().smallJiraSeven()
)
).host(FlakyJdkWorkaround.STABLE_DATASET_HOST)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.atlassian.performance.tools.awsinfrastructure.api.jira

import com.atlassian.performance.tools.aws.api.Investment
import com.atlassian.performance.tools.aws.api.SshKeyFormula
import com.atlassian.performance.tools.awsinfrastructure.FlakyJdkWorkaround
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime
import com.atlassian.performance.tools.awsinfrastructure.api.DatasetCatalogue
import com.atlassian.performance.tools.awsinfrastructure.api.hardware.C5NineExtraLargeEphemeral
Expand All @@ -13,7 +14,6 @@ import com.atlassian.performance.tools.infrastructure.api.jira.MinimalMysqlJiraH
import com.atlassian.performance.tools.infrastructure.api.jvm.OpenJDK
import com.atlassian.performance.tools.infrastructure.api.jvm.jmx.EnabledRemoteJmx
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.data.Percentage.withPercentage
import org.junit.Test
Expand All @@ -31,13 +31,6 @@ class DataCenterFormulaIT {
private val workspace = IntegrationTestRuntime.taskWorkspace
private val aws = IntegrationTestRuntime.aws

/**
* The default JDK in [JiraNodeConfig] is flaky to install.
*/
private val stableJdk = JiraNodeConfig.Builder()
.versionedJdk(OpenJDK())
.build()

@Test
fun shouldProvisionDataCenter() {
val dataset = DatasetCatalogue().largeJiraEight()
Expand All @@ -52,7 +45,7 @@ class DataCenterFormulaIT {
prefix = nonce
)
val nodeCount = 2
val nodeConfigs = JiraNodeConfig.Builder(stableJdk)
val nodeConfigs = JiraNodeConfig.Builder(FlakyJdkWorkaround.STABLE_JDK_CONFIG)
.remoteJmx(EnabledRemoteJmx())
.build()
.multipleNodes(nodeCount)
Expand Down Expand Up @@ -125,7 +118,7 @@ class DataCenterFormulaIT {
val database = MinimalMysqlDatabase.Builder().build()
val nodeCount = 1
val jiraFormula = DataCenterFormula.Builder(distribution, jiraHome, database)
.configs(stableJdk.multipleNodes(nodeCount))
.configs(FlakyJdkWorkaround.STABLE_JDK_CONFIG.multipleNodes(nodeCount))
.waitForUpgrades(false)
.build()
val investment = Investment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.atlassian.performance.tools.awsinfrastructure.api.jira

import com.atlassian.performance.tools.aws.api.Investment
import com.atlassian.performance.tools.aws.api.SshKeyFormula
import com.atlassian.performance.tools.awsinfrastructure.FlakyJdkWorkaround
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime.aws
import com.atlassian.performance.tools.awsinfrastructure.IntegrationTestRuntime.taskWorkspace
import com.atlassian.performance.tools.awsinfrastructure.api.DatasetCatalogue
Expand All @@ -27,13 +28,6 @@ class StandaloneFormulaIT {
private val workspace = taskWorkspace.isolateTest(javaClass.simpleName)
private val dataset = DatasetCatalogue().smallJiraSeven()

/**
* The default JDK in [JiraNodeConfig] is flaky to install.
*/
private val stableJdk = JiraNodeConfig.Builder()
.versionedJdk(OpenJDK())
.build()

@Test
fun shouldProvisionServer() {
val nonce = UUID.randomUUID().toString()
Expand All @@ -52,7 +46,7 @@ class StandaloneFormulaIT {
.jiraVolume(Volume(80))
.databaseComputer(C5NineExtraLargeEphemeral())
.databaseVolume(Volume(90))
.config(stableJdk)
.config(FlakyJdkWorkaround.STABLE_JDK_CONFIG)
.build()
val copiedFormula = StandaloneFormula.Builder(serverFormula).build()

Expand All @@ -77,7 +71,7 @@ class StandaloneFormulaIT {
val jiraHome = MinimalMysqlJiraHome()
val database = MinimalMysqlDatabase.Builder().build()
val jiraFormula = StandaloneFormula.Builder(distribution, jiraHome, database)
.config(stableJdk)
.config(FlakyJdkWorkaround.STABLE_JDK_CONFIG)
.waitForUpgrades(false)
.build()
val investment = Investment(
Expand Down

0 comments on commit 1d4fed9

Please sign in to comment.