From b4dde6a8394ddf40b13ab744ae8c9e18a06ad54a Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Mon, 26 Feb 2024 16:20:07 +0000 Subject: [PATCH] Allow integration tests to run locally This change adds the ability to run integration tests locally. You will still need a number of environment variables set, including a github PAT. Details on how to use this will come in a subsequent commit. Signed-off-by: Gabriel Adrian Samfira --- Makefile | 24 +++++++++- test/integration/config/config.toml | 10 ++-- test/integration/e2e/e2e.go | 15 +++--- test/integration/e2e/instances.go | 4 +- test/integration/e2e/repositories.go | 4 +- test/integration/main.go | 14 +++--- test/integration/scripts/setup-garm.sh | 64 ++++++++++++++++++-------- 7 files changed, 95 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index 3914e9be..dcd20bf0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ -SHELL := bash +SHELL := /bin/bash +export SHELLOPTS:=$(if $(SHELLOPTS),$(SHELLOPTS):)pipefail:errexit +.ONESHELL: + +GEN_PASSWORD=$(shell (/bin/bash -c 'tr -dc "a-zA-Z0-9" /dev/null +sudo chown -R $RUN_USER:$RUN_USER ${GARM_CONFIG_DIR} + +sudo mkdir -p ${GARM_CONFIG_DIR}/test-provider sudo touch $CONFIG_DIR_PROV/config -sudo cp $CONFIG_DIR_PROV/* /etc/garm/test-provider +sudo cp $CONFIG_DIR_PROV/* ${GARM_CONFIG_DIR}/test-provider sudo mv $BINARIES_DIR/* /usr/local/bin/ -sudo cp $CONTRIB_DIR/garm.service /etc/systemd/system/garm.service - -sudo systemctl daemon-reload -sudo systemctl start garm +mkdir -p $HOME/.local/share/systemd/user/ +cat $CONFIG_DIR/garm.service| envsubst | tee $HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service > /dev/null +sudo chown -R $RUN_USER:$RUN_USER ${GARM_CONFIG_DIR} -wait_open_port 127.0.0.1 9997 +systemctl --user daemon-reload +systemctl --user restart ${GARM_SERVICE_NAME} +wait_open_port 127.0.0.1 ${GARM_PORT} echo "GARM is up and running" +echo "GARM config file is $GARM_CONFIG_FILE" +echo "GARM service name is $GARM_SERVICE_NAME"