Skip to content

Commit

Permalink
Refactor tests to use new helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahFrench committed Feb 16, 2024
1 parent d9b04fd commit 93b9805
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,12 @@ class NightlyTestProjectsTests {
val project = googleCloudRootProject(testContextParameters())

// Find GA nightly test project
var gaProject: Project? = project.subProjects.find { p-> p.name == gaProjectName}
if (gaProject == null) {
Assert.fail("Could not find the Google (GA) project")
}
var gaNightlyTestProject: Project? = gaProject!!.subProjects.find { p-> p.name == nightlyTestsProjectName}
if (gaNightlyTestProject == null) {
Assert.fail("Could not find the Google (GA) Nightly Test project")
}
var gaNightlyTestProject = getSubProject(project, gaProjectName, nightlyTestsProjectName)

// Find Beta nightly test project
var betaProject: Project? = project.subProjects.find { p-> p.name == betaProjectName}
if (betaProject == null) {
Assert.fail("Could not find the Google (Beta) project")
}
var betaNightlyTestProject: Project? = betaProject!!.subProjects.find { p-> p.name == nightlyTestsProjectName}
if (betaNightlyTestProject == null) {
Assert.fail("Could not find the Google (GA) Nightly Test project")
}
var betaNightlyTestProject = getSubProject(project, betaProjectName, nightlyTestsProjectName)

// Make assertions about builds in both nightly test projects
(gaNightlyTestProject!!.buildTypes + betaNightlyTestProject!!.buildTypes).forEach{bt ->
assertTrue("Build configuration `${bt.name}` contains at least one trigger", bt.triggers.items.isNotEmpty())
// Look for at least one CRON trigger
Expand Down
18 changes: 2 additions & 16 deletions mmv1/third_party/terraform/.teamcity/tests/sweepers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,7 @@ class SweeperTests {
val project = googleCloudRootProject(testContextParameters())

// Find GA nightly test project
val gaProject: Project? = project.subProjects.find { p-> p.name == gaProjectName}
if (gaProject == null) {
Assert.fail("Could not find the Google (GA) project")
}
val gaNightlyTestProject: Project? = gaProject!!.subProjects.find { p-> p.name == nightlyTestsProjectName}
if (gaNightlyTestProject == null) {
Assert.fail("Could not find the Google (GA) Nightly Test project")
}
var gaNightlyTestProject = getSubProject(project, gaProjectName, nightlyTestsProjectName)

// Find sweeper inside
val sweeper: BuildType? = gaNightlyTestProject!!.buildTypes.find { p-> p.name == ServiceSweeperName}
Expand All @@ -67,14 +60,7 @@ class SweeperTests {
val project = googleCloudRootProject(testContextParameters())

// Find Beta nightly test project
val betaProject: Project? = project.subProjects.find { p-> p.name == betaProjectName}
if (betaProject == null) {
Assert.fail("Could not find the Google (GA) project")
}
val betaNightlyTestProject: Project? = betaProject!!.subProjects.find { p-> p.name == nightlyTestsProjectName}
if (betaNightlyTestProject == null) {
Assert.fail("Could not find the Google (GA) Nightly Test project")
}
var betaNightlyTestProject = getSubProject(project, betaProjectName, nightlyTestsProjectName)

// Find sweeper inside
val sweeper: BuildType? = betaNightlyTestProject!!.buildTypes.find { p-> p.name == ServiceSweeperName}
Expand Down

0 comments on commit 93b9805

Please sign in to comment.