system-tests: add debug flag

This commit is contained in:
André Roth
2026-05-14 20:38:59 +02:00
parent d27c5856de
commit 174ced253f
4 changed files with 17 additions and 6 deletions
+7 -2
View File
@@ -29,6 +29,11 @@ ifeq ($(CAPTURE),1)
CAPTURE_ARG := --capture CAPTURE_ARG := --capture
endif endif
# export DEBUG=1 to enable debug output in system tests
ifeq ($(DEBUG),1)
DEBUG_ARG := --debug
endif
help: ## Print this help help: ## Print this help
@grep -E '^[a-zA-Z][a-zA-Z0-9_-]*:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z][a-zA-Z0-9_-]*:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@@ -121,7 +126,7 @@ system-test: prepare swagger etcd-install ## Run system tests
if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi
test -f ~/etcd.db || (curl -o ~/etcd.db.xz http://repo.aptly.info/system-tests/etcd.db.xz && xz -d ~/etcd.db.xz) test -f ~/etcd.db || (curl -o ~/etcd.db.xz http://repo.aptly.info/system-tests/etcd.db.xz && xz -d ~/etcd.db.xz)
# Run system tests # Run system tests
PATH=$(BINPATH)/:$(PATH) FORCE_COLOR=1 $(PYTHON) system/run.py --long $(COVERAGE_ARG_TEST) $(CAPTURE_ARG) $(TEST) PATH=$(BINPATH)/:$(PATH) FORCE_COLOR=1 $(PYTHON) system/run.py --long $(COVERAGE_ARG_TEST) $(CAPTURE_ARG) $(DEBUG_ARG) $(TEST)
bench: bench:
@echo "\e[33m\e[1mRunning benchmark ...\e[0m" @echo "\e[33m\e[1mRunning benchmark ...\e[0m"
@@ -211,7 +216,7 @@ docker-system-test: ## Run system tests in docker container (add TEST=t04_mirro
AZURE_STORAGE_ACCESS_KEY="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" \ AZURE_STORAGE_ACCESS_KEY="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" \
AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) \ AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) \
AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) \ AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) \
system-test TEST=$(TEST) CAPTURE=$(CAPTURE) COVERAGE_SKIP=$(COVERAGE_SKIP) \ system-test TEST=$(TEST) CAPTURE=$(CAPTURE) COVERAGE_SKIP=$(COVERAGE_SKIP) DEBUG=$(DEBUG) \
azurite-stop azurite-stop
docker-serve: ## Run development server (auto recompiling) on http://localhost:3142 docker-serve: ## Run development server (auto recompiling) on http://localhost:3142
+1 -1
View File
@@ -25,7 +25,7 @@ class APITest(BaseTest):
""" """
aptly_server = None aptly_server = None
aptly_out = None aptly_out = None
debugOutput = True debugOutput = False # Controlled by --debug flag in run.py
base_url = "127.0.0.1:8765" base_url = "127.0.0.1:8765"
configOverride = { configOverride = {
"FileSystemPublishEndpoints": { "FileSystemPublishEndpoints": {
+8 -2
View File
@@ -36,7 +36,7 @@ def natural_key(string_):
return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_)] return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_)]
def run(include_long_tests=False, capture_results=False, tests=None, filters=None, coverage_dir=None, coverage_skip=False): def run(include_long_tests=False, capture_results=False, tests=None, filters=None, coverage_dir=None, coverage_skip=False, debug=False):
""" """
Run system test. Run system test.
""" """
@@ -50,6 +50,9 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non
if not coverage_dir and not coverage_skip: if not coverage_dir and not coverage_skip:
coverage_dir = mkdtemp(suffix="aptly-coverage") coverage_dir = mkdtemp(suffix="aptly-coverage")
# Set debug output globally for all test classes
BaseTest.debugOutput = debug
failed = False failed = False
for test in tests: for test in tests:
orig_stdout = sys.stdout orig_stdout = sys.stdout
@@ -215,6 +218,7 @@ if __name__ == "__main__":
capture_results = False capture_results = False
coverage_dir = None coverage_dir = None
coverage_skip = False coverage_skip = False
debug = False
tests = None tests = None
args = sys.argv[1:] args = sys.argv[1:]
@@ -228,6 +232,8 @@ if __name__ == "__main__":
args = args[1:] args = args[1:]
elif args[0] == "--coverage-skip": elif args[0] == "--coverage-skip":
coverage_skip = True coverage_skip = True
elif args[0] == "--debug":
debug = True
args = args[1:] args = args[1:]
@@ -240,4 +246,4 @@ if __name__ == "__main__":
else: else:
filters.append(arg) filters.append(arg)
run(include_long_tests, capture_results, tests, filters, coverage_dir, coverage_skip) run(include_long_tests, capture_results, tests, filters, coverage_dir, coverage_skip, debug)
+1 -1
View File
@@ -14,7 +14,7 @@ class UnixSocketAPITest(BaseTest):
socket_path = "/tmp/_aptly_test.sock" socket_path = "/tmp/_aptly_test.sock"
base_url = ("unix://%s" % socket_path) base_url = ("unix://%s" % socket_path)
aptly_out = None aptly_out = None
debugOutput = True debugOutput = False # Controlled by --debug flag in run.py
def prepare(self): def prepare(self):
if self.aptly_server is None: if self.aptly_server is None: