Files
gerrit/e2e-tests
Nguyen Tuan Khang Phan e1637029a3 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
2021-04-01 12:15:35 -04:00
..

#!/bin/bash
#
# Example usage only-
# 1. Optional: replace test@mail.com below with your own, reachable locally.
# 2. Use the '>>' operator below instead to not overwrite your known_hosts; keep '>' otherwise.
# 3. Note that appending as proposed above may potentially repeat the same line multiple times.
# 4. Init your local Gerrit test site then start it; you may refer to [1] below.
# 5. Set GIT_HTTP_PASSWORD below to yours, from [2].
# 6. Change to this directory to execute ./README (this executable file) in its own terminal.
# 7. Install sbt if missing, based on your operating system; re-run to compile.
# 8. Optional: add the below generated (displayed) key to your local admin user [3].
# 9. Otherwise keep the lines below that use your existing user ssh keys for admin testing.
# 10. This script assumes the google-sourced version of the example json file [4].
# 11. If running that scenario locally as below reports authentication failures, [4] may be a fork.
# 12. Uncomment any one of the below sbt commands at will; you may add some locally.
# 13. See [5] for how to start using JAVA_OPTS below; you may leave it empty for these sbt commands.
# 14. You can initialize an IDE sbt (Scala) project from/in this root folder; see [6].
#
# [1] https://gerrit-review.googlesource.com/Documentation/dev-readme.html#init
# [2] http://localhost:8080/settings/#HTTPCredentials
# [3] http://localhost:8080/settings/#SSHKeys
# [4] ./src/test/resources/data/com/google/gerrit/scenarios/CloneUsingBothProtocols.json
# [5] https://gerrit-review.googlesource.com/Documentation/dev-e2e-tests.html#_environment_properties
# [6] https://gerrit-review.googlesource.com/Documentation/dev-e2e-tests.html#_ide_intellij

# DO NOT change this (assumed) directory; force-removed *recursively* below!
gatlingGitKeys=/tmp/ssh-keys

userSshDir=$HOME/.ssh

# Comment this group of lines out if willing to generate other keys as below.
rm -f $gatlingGitKeys
ln -s "$userSshDir" $gatlingGitKeys

# Comment this group of lines out if keys already generated, as either below or above.
#rm -fr $gatlingGitKeys
#mkdir $gatlingGitKeys
#ssh-keygen -m PEM -t rsa -C "test@mail.com" -f $gatlingGitKeys/id_rsa

ssh-keyscan -t rsa -p 29418 localhost > "$userSshDir"/known_hosts
cat $gatlingGitKeys/id_rsa.pub

export GIT_HTTP_USERNAME="admin"
export GIT_HTTP_PASSWORD="TODO"
export JAVA_OPTS="\
"
#-Dx=y \

#sbt clean
#sbt update
sbt compile
#sbt "gatling:testOnly com.google.gerrit.scenarios.CloneUsingBothProtocols"
#sbt "gatling:lastReport"