e2e-tests: Add a force option to delete project scenario
Before this change, DeleteProject step only performed project deletion if there were no open changes within the test project. So, if one of the test fails, leaving behind an open change. As a result the test project will not be deleted in the DeleteProject step. Next run of the same test will also keep failing until the test project is manually removed. In a scenario of automotive tests, a CI will keep producing erroneous test reports, until the user fixes the problem by manually deleting the test project. With this change project deletion can be done with force option. Force deletion is useful because it allows tests to run successively even if one of the test failed and left an open change in a test project. To enable forced deletion, an environment property needs to be configured: -Dcom.google.gerrit.scenarios.force_project_deletion=true By default force_project_deletion is set to false. Change-Id: I2b84419b3665b85465a441a214bf23c420fae0c5
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"force": "${force_project_deletion}"
|
||||
}
|
@@ -20,6 +20,7 @@ import io.gatling.core.structure.ScenarioBuilder
|
||||
|
||||
class DeleteProject extends ProjectSimulation {
|
||||
private val data: FeederBuilder = jsonFile(resource).convert(keys).queue
|
||||
private val forceKey = "force_project_deletion"
|
||||
|
||||
def this(projectName: String) {
|
||||
this()
|
||||
@@ -28,7 +29,10 @@ class DeleteProject extends ProjectSimulation {
|
||||
|
||||
val test: ScenarioBuilder = scenario(uniqueName)
|
||||
.feed(data)
|
||||
.exec(httpRequest)
|
||||
.exec(session => {
|
||||
session.set(forceKey, getProperty(forceKey, "false"))
|
||||
})
|
||||
.exec(httpRequest.body(ElFileBody(body)).asJson)
|
||||
|
||||
setUp(
|
||||
test.inject(
|
||||
|
Reference in New Issue
Block a user