mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-30 04:20:53 +00:00
system-tests: add debug flag
This commit is contained in:
@@ -29,6 +29,11 @@ ifeq ($(CAPTURE),1)
|
||||
CAPTURE_ARG := --capture
|
||||
endif
|
||||
|
||||
# export DEBUG=1 to enable debug output in system tests
|
||||
ifeq ($(DEBUG),1)
|
||||
DEBUG_ARG := --debug
|
||||
endif
|
||||
|
||||
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}'
|
||||
|
||||
@@ -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
|
||||
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
|
||||
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:
|
||||
@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==" \
|
||||
AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) \
|
||||
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
|
||||
|
||||
docker-serve: ## Run development server (auto recompiling) on http://localhost:3142
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ class APITest(BaseTest):
|
||||
"""
|
||||
aptly_server = None
|
||||
aptly_out = None
|
||||
debugOutput = True
|
||||
debugOutput = False # Controlled by --debug flag in run.py
|
||||
base_url = "127.0.0.1:8765"
|
||||
configOverride = {
|
||||
"FileSystemPublishEndpoints": {
|
||||
|
||||
+8
-2
@@ -36,7 +36,7 @@ def natural_key(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.
|
||||
"""
|
||||
@@ -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:
|
||||
coverage_dir = mkdtemp(suffix="aptly-coverage")
|
||||
|
||||
# Set debug output globally for all test classes
|
||||
BaseTest.debugOutput = debug
|
||||
|
||||
failed = False
|
||||
for test in tests:
|
||||
orig_stdout = sys.stdout
|
||||
@@ -215,6 +218,7 @@ if __name__ == "__main__":
|
||||
capture_results = False
|
||||
coverage_dir = None
|
||||
coverage_skip = False
|
||||
debug = False
|
||||
tests = None
|
||||
args = sys.argv[1:]
|
||||
|
||||
@@ -228,6 +232,8 @@ if __name__ == "__main__":
|
||||
args = args[1:]
|
||||
elif args[0] == "--coverage-skip":
|
||||
coverage_skip = True
|
||||
elif args[0] == "--debug":
|
||||
debug = True
|
||||
|
||||
args = args[1:]
|
||||
|
||||
@@ -240,4 +246,4 @@ if __name__ == "__main__":
|
||||
else:
|
||||
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)
|
||||
|
||||
@@ -14,7 +14,7 @@ class UnixSocketAPITest(BaseTest):
|
||||
socket_path = "/tmp/_aptly_test.sock"
|
||||
base_url = ("unix://%s" % socket_path)
|
||||
aptly_out = None
|
||||
debugOutput = True
|
||||
debugOutput = False # Controlled by --debug flag in run.py
|
||||
|
||||
def prepare(self):
|
||||
if self.aptly_server is None:
|
||||
|
||||
Reference in New Issue
Block a user