Avoid creating new admin user
Utilize the existing admin user created by init steps and start the
run_tests container with that user.
Change-Id: Ie85637846a6f1b650907089480749bf1bd9086e6
diff --git a/test/docker/run.sh b/test/docker/run.sh
index 75b9b3a..5f9b412 100755
--- a/test/docker/run.sh
+++ b/test/docker/run.sh
@@ -57,12 +57,12 @@
run_task_plugin_tests() {
docker-compose "${COMPOSE_ARGS[@]}" up --detach
- docker-compose "${COMPOSE_ARGS[@]}" exec -T --user=gerrit_admin run_tests \
+ docker-compose "${COMPOSE_ARGS[@]}" exec -T --user=admin run_tests \
'/task/test/docker/run_tests/start.sh'
}
retest() {
- docker-compose "${COMPOSE_ARGS[@]}" exec -T --user=gerrit_admin \
+ docker-compose "${COMPOSE_ARGS[@]}" exec -T --user=admin \
run_tests task/test/docker/run_tests/start.sh retest
RESULT=$?
cleanup
diff --git a/test/docker/run_tests/Dockerfile b/test/docker/run_tests/Dockerfile
index 06691e1..58eb6c8 100755
--- a/test/docker/run_tests/Dockerfile
+++ b/test/docker/run_tests/Dockerfile
@@ -2,7 +2,7 @@
ARG UID=1000
ARG GID=1000
-ENV USER gerrit_admin
+ENV USER admin
ENV USER_HOME /home/$USER
ENV RUN_TESTS_DIR task/test/docker/run_tests
ENV WORKSPACE $USER_HOME/workspace
@@ -21,6 +21,6 @@
RUN chmod 400 "$USER_HOME"/.ssh/id_rsa
RUN chmod 400 "$USER_HOME"/.ssh/id_rsa.pub
RUN git config --global user.name "Gerrit Admin"
-RUN git config --global user.email "gerrit_admin@localdomain"
+RUN git config --global user.email "admin@example.com"
ENTRYPOINT ["tail", "-f", "/dev/null"]
diff --git a/test/docker/run_tests/start.sh b/test/docker/run_tests/start.sh
index 1d31d0b..2cc3df2 100755
--- a/test/docker/run_tests/start.sh
+++ b/test/docker/run_tests/start.sh
@@ -19,8 +19,8 @@
echo "Creating a default user account ..."
cat "$USER_HOME"/.ssh/id_rsa.pub | ssh -p 29418 -i /server-ssh-key/ssh_host_rsa_key \
- "Gerrit Code Review@$GERRIT_HOST" suexec --as "admin@example.com" -- gerrit create-account \
- --ssh-key - --email "gerrit_admin@localdomain" --group "Administrators" "gerrit_admin"
+ "Gerrit Code Review@$GERRIT_HOST" suexec --as "admin@example.com" -- gerrit set-account \
+ admin --add-ssh-key -
is_plugin_loaded "task" || die "Task plugin is not installed"