From 1d4fed97e536927c88143435929fd380e9e4fa25 Mon Sep 17 00:00:00 2001 From: Maciej Kwidzinski Date: Mon, 24 Jun 2024 11:58:58 +0200 Subject: [PATCH] Stabilize `SshMysqlDatasetPublicationIT` Also, centralize the workaround. --- .../awsinfrastructure/FlakyJdkWorkaround.kt | 51 +++++++++++++++++++ .../api/AwsDatasetModificationIT.kt | 34 +------------ .../api/CustomDatasetSourceIT.kt | 2 + .../dataset/SshMysqlDatasetPublicationIT.kt | 3 +- .../api/jira/DataCenterFormulaIT.kt | 13 ++--- .../api/jira/StandaloneFormulaIT.kt | 12 ++--- 6 files changed, 63 insertions(+), 52 deletions(-) create mode 100644 src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/FlakyJdkWorkaround.kt diff --git a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/FlakyJdkWorkaround.kt b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/FlakyJdkWorkaround.kt new file mode 100644 index 00000000..9433ecc8 --- /dev/null +++ b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/FlakyJdkWorkaround.kt @@ -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() + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/AwsDatasetModificationIT.kt b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/AwsDatasetModificationIT.kt index 263f2ca2..b8ae2f76 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/AwsDatasetModificationIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/AwsDatasetModificationIT.kt @@ -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 @@ -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() diff --git a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/CustomDatasetSourceIT.kt b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/CustomDatasetSourceIT.kt index 34d99c1f..e9272cc9 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/CustomDatasetSourceIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/CustomDatasetSourceIT.kt @@ -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 @@ -49,6 +50,7 @@ class CustomDatasetSourceIT { jiraHomeSource = sourceDataset.jiraHomeSource, productDistribution = PublicJiraSoftwareDistribution("9.9.0") ) + .config(FlakyJdkWorkaround.STABLE_JDK_CONFIG) .build() .provision( investment = Investment( diff --git a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/dataset/SshMysqlDatasetPublicationIT.kt b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/dataset/SshMysqlDatasetPublicationIT.kt index 9a0b7149..750359b5 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/dataset/SshMysqlDatasetPublicationIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/dataset/SshMysqlDatasetPublicationIT.kt @@ -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 @@ -15,7 +16,7 @@ class SshMysqlDatasetPublicationIT { AwsDatasetModification.Builder( aws, DatasetCatalogue().smallJiraSeven() - ) + ).host(FlakyJdkWorkaround.STABLE_DATASET_HOST) ) } } \ No newline at end of file diff --git a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/DataCenterFormulaIT.kt b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/DataCenterFormulaIT.kt index 32df4d3f..6d1df822 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/DataCenterFormulaIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/DataCenterFormulaIT.kt @@ -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 @@ -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 @@ -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() @@ -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) @@ -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( diff --git a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/StandaloneFormulaIT.kt b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/StandaloneFormulaIT.kt index 19637121..3f3ae938 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/StandaloneFormulaIT.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/awsinfrastructure/api/jira/StandaloneFormulaIT.kt @@ -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 @@ -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() @@ -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() @@ -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(