Skip to content

Commit e99e274

Browse files
Made acceptance tests set empty string for compatibility with pre-7.X providers (#15134) (#24363)
[upstream:15470c49782155700b933a6b55b515af28dabb22] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent 7bf6783 commit e99e274

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

.teamcity/components/builds/build_configuration_per_package.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import replaceCharsId
2020

2121
// BuildConfigurationsForPackages accepts a map containing details of multiple packages in a provider and returns a list of build configurations for them all.
2222
// Intended to be used in projects where we're testing all packages, e.g. the nightly test projects
23-
fun BuildConfigurationsForPackages(packages: Map<String, Map<String, String>>, providerName: String, parentProjectName: String, vcsRoot: GitVcsRoot, sharedResources: List<String>, environmentVariables: AccTestConfiguration, testPrefix: String = "TestAcc", releaseDiffTest: String = "false"): List<BuildType> {
23+
fun BuildConfigurationsForPackages(packages: Map<String, Map<String, String>>, providerName: String, parentProjectName: String, vcsRoot: GitVcsRoot, sharedResources: List<String>, environmentVariables: AccTestConfiguration, testPrefix: String = "TestAcc", releaseDiffTest: Boolean = false): List<BuildType> {
2424
val list = ArrayList<BuildType>()
2525

2626
// Create build configurations for all packages, except sweeper
@@ -38,16 +38,16 @@ fun BuildConfigurationsForPackages(packages: Map<String, Map<String, String>>, p
3838

3939
// BuildConfigurationForSinglePackage accepts details of a single package in a provider and returns a build configuration for it
4040
// Intended to be used in short-lived projects where we're testing specific packages, e.g. feature branch testing
41-
fun BuildConfigurationForSinglePackage(packageName: String, packagePath: String, packageDisplayName: String, providerName: String, parentProjectName: String, vcsRoot: GitVcsRoot, sharedResources: List<String>, environmentVariables: AccTestConfiguration, testPrefix: String = "TestAcc", releaseDiffTest: String = "false"): BuildType{
41+
fun BuildConfigurationForSinglePackage(packageName: String, packagePath: String, packageDisplayName: String, providerName: String, parentProjectName: String, vcsRoot: GitVcsRoot, sharedResources: List<String>, environmentVariables: AccTestConfiguration, testPrefix: String = "TestAcc", releaseDiffTest: Boolean = false): BuildType{
4242
val pkg = PackageDetails(packageName, packageDisplayName, providerName, parentProjectName, releaseDiffTest = releaseDiffTest)
4343
return pkg.buildConfiguration(packagePath, vcsRoot, sharedResources, environmentVariables, testPrefix = testPrefix, releaseDiffTest = releaseDiffTest)
4444
}
4545

46-
class PackageDetails(private val packageName: String, private val displayName: String, private val providerName: String, private val parentProjectName: String, private val releaseDiffTest: String) {
46+
class PackageDetails(private val packageName: String, private val displayName: String, private val providerName: String, private val parentProjectName: String, private val releaseDiffTest: Boolean) {
4747

4848
// buildConfiguration returns a BuildType for a service package
4949
// For BuildType docs, see https://teamcity.jetbrains.com/app/dsl-documentation/root/build-type/index.html
50-
fun buildConfiguration(path: String, vcsRoot: GitVcsRoot, sharedResources: List<String>, environmentVariables: AccTestConfiguration, buildTimeout: Int = DefaultBuildTimeoutDuration, testPrefix: String, releaseDiffTest: String): BuildType {
50+
fun buildConfiguration(path: String, vcsRoot: GitVcsRoot, sharedResources: List<String>, environmentVariables: AccTestConfiguration, buildTimeout: Int = DefaultBuildTimeoutDuration, testPrefix: String, releaseDiffTest: Boolean): BuildType {
5151
val testPrefix = "TestAcc"
5252
val testTimeout = "12"
5353

@@ -72,7 +72,7 @@ class PackageDetails(private val packageName: String, private val displayName: S
7272
tagBuildToIndicateTriggerMethod()
7373
configureGoEnv()
7474
downloadTerraformBinary()
75-
if (releaseDiffTest.toBoolean()) {
75+
if (releaseDiffTest) {
7676
runDiffTests()
7777
} else {
7878
runAcceptanceTests()

.teamcity/components/builds/build_configuration_sweepers.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SweeperDetails(private val sweeperName: String, private val parentProjectN
6161
// These hardcoded values affect the sweeper CLI command's behaviour
6262
val testPrefix = "TestAcc"
6363
val testTimeout = "12"
64-
val releaseDiffTest = "false"
64+
val releaseDiffTest = false
6565

6666
return BuildType {
6767

.teamcity/components/builds/build_configuration_vcr_recording.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class VcrDetails(private val providerName: String, private val buildId: String,
2727
val testTimeout = "12"
2828
val parallelism = DefaultParallelism
2929
val buildTimeout: Int = DefaultBuildTimeoutDuration
30-
val releaseDiffTest = "false"
30+
val releaseDiffTest = false
3131

3232
// Path is just ./google(-beta) here, whereas nightly test builds use paths like ./google/something/specific
3333
// This helps VCR testing builds to run tests across multiple packages

.teamcity/components/builds/build_parameters.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,17 @@ fun ParametrizedWithType.configureGoogleSpecificTestParameters(config: AccTestCo
205205

206206
// ParametrizedWithType.acceptanceTestBuildParams sets build params that affect how commands to run
207207
// acceptance tests are templated
208-
fun ParametrizedWithType.acceptanceTestBuildParams(parallelism: Int, prefix: String, timeout: String, releaseDiffTest: String) {
208+
fun ParametrizedWithType.acceptanceTestBuildParams(parallelism: Int, prefix: String, timeout: String, releaseDiffTest: Boolean) {
209209
hiddenVariable("env.TF_ACC", "1", "Set to a value to run the Acceptance Tests")
210210
text("PARALLELISM", "%d".format(parallelism))
211211
text("TEST_PREFIX", prefix)
212212
text("TIMEOUT", timeout)
213-
text("env.RELEASE_DIFF", releaseDiffTest)
213+
if (releaseDiffTest) {
214+
text("env.RELEASE_DIFF", "true")
215+
} else {
216+
// Use an empty string for backwards-compatibility with pre-7.X release diff behavior.
217+
text("env.RELEASE_DIFF", "")
218+
}
214219
}
215220

216221
// ParametrizedWithType.sweeperParameters sets build parameters that affect how sweepers are run

.teamcity/components/projects/reused/weekly_diff_tests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fun weeklyDiffTests(parentProject:String, providerName: String, vcsRoot: GitVcsR
3737
// Create build configs to run acceptance tests for each package defined in packages.kt and services.kt files
3838
// and add cron trigger to them all
3939
val allPackages = getAllPackageInProviderVersion(providerName)
40-
val packageBuildConfigs = BuildConfigurationsForPackages(allPackages, providerName, projectId, vcsRoot, sharedResources, config, releaseDiffTest = "true")
40+
val packageBuildConfigs = BuildConfigurationsForPackages(allPackages, providerName, projectId, vcsRoot, sharedResources, config, releaseDiffTest = true)
4141
packageBuildConfigs.forEach { buildConfiguration ->
4242
buildConfiguration.addTrigger(cron)
4343
}

0 commit comments

Comments
 (0)