mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
system-tests: make docker abortable and use colors
This commit is contained in:
8
Makefile
8
Makefile
@@ -53,7 +53,7 @@ ifeq ($(RUN_LONG_TESTS), yes)
|
||||
go test -v -coverpkg="./..." -c -tags testruncli
|
||||
if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi
|
||||
if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi
|
||||
PATH=$(BINPATH)/:$(PATH) && . system/env/bin/activate && APTLY_VERSION=$(VERSION) $(PYTHON) system/run.py --long $(TESTS) --coverage-dir $(COVERAGE_DIR) $(CAPTURE)
|
||||
PATH=$(BINPATH)/:$(PATH) && . system/env/bin/activate && APTLY_VERSION=$(VERSION) FORCE_COLOR=1 $(PYTHON) system/run.py --long $(TESTS) --coverage-dir $(COVERAGE_DIR) $(CAPTURE)
|
||||
endif
|
||||
|
||||
docker-test: install
|
||||
@@ -96,13 +96,13 @@ docker-build-system-tests: ## Build system-test docker image
|
||||
docker build -f system/Dockerfile --no-cache . -t aptly-system-test
|
||||
|
||||
docker-unit-tests: ## Run unit tests in docker container
|
||||
docker run -t --rm -v ${PWD}:/app aptly-system-test go test -v ./... -gocheck.v=true
|
||||
docker run -it --rm -v ${PWD}:/app aptly-system-test go test -v ./... -gocheck.v=true
|
||||
|
||||
docker-system-tests: ## Run system tests in docker container (add TEST=t04_mirror to run only specific tests)
|
||||
docker run -t --rm -v ${PWD}:/app aptly-system-test /app/system/run-system-tests $(TEST)
|
||||
docker run -it --rm -v ${PWD}:/app aptly-system-test /app/system/run-system-tests $(TEST)
|
||||
|
||||
golangci-lint: ## Run golangci-line in docker container
|
||||
docker run -t --rm -v ~/.cache/golangci-lint/v1.56.2:/root/.cache -v ${PWD}:/app -w /app golangci/golangci-lint:v1.56.2 golangci-lint run
|
||||
docker run -it --rm -v ~/.cache/golangci-lint/v1.56.2:/root/.cache -v ${PWD}:/app -w /app golangci/golangci-lint:v1.56.2 golangci-lint run
|
||||
|
||||
flake8:
|
||||
flake8 system
|
||||
|
||||
@@ -4,7 +4,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg &
|
||||
|
||||
RUN echo deb http://deb.debian.org/debian bookworm-backports main > /etc/apt/sources.list.d/backports.list
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends apg bzip2 xz-utils ca-certificates golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports make git python3 python3-requests-unixsocket && \
|
||||
apt-get install -y --no-install-recommends apg bzip2 xz-utils ca-certificates golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports make git python3 python3-requests-unixsocket python3-termcolor && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd -m --shell /bin/sh --home-dir /var/lib/aptly aptly
|
||||
|
||||
@@ -81,7 +81,7 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non
|
||||
if not matches:
|
||||
continue
|
||||
|
||||
sys.stdout.write("%s:%s... " % (test, o.__name__))
|
||||
sys.stdout.write(colored("%s:%s... ", color="yellow", attrs=["bold"]) % (test, o.__name__))
|
||||
sys.stdout.flush()
|
||||
|
||||
t = o()
|
||||
@@ -105,9 +105,9 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non
|
||||
typ, val, tb = sys.exc_info()
|
||||
fails.append((test, t, typ, val, tb, testModule))
|
||||
traceback.print_exception(typ, val, tb)
|
||||
sys.stdout.write(colored("FAIL\n", color="red"))
|
||||
sys.stdout.write(colored("FAIL\n", color="red", attrs=["bold"]))
|
||||
else:
|
||||
sys.stdout.write(colored("OK\n", color="green"))
|
||||
sys.stdout.write(colored("OK\n", color="green", attrs=["bold"]))
|
||||
|
||||
t.shutdown()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user