[DNM][WIP] Lint tests
Change-Id: I237f710513fc681e09f90fd5d5451aebced93291
This commit is contained in:
parent
caa75e403e
commit
4120b6dc0c
|
@ -22,6 +22,7 @@
|
|||
check:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
- openstack-tox-bashate
|
||||
- armada-chart-build-gate
|
||||
- armada-chart-build-latest-htk
|
||||
- armada-docker-build-gate-ubuntu_bionic
|
||||
|
@ -31,6 +32,7 @@
|
|||
gate:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
- openstack-tox-bashate
|
||||
- armada-chart-build-gate
|
||||
- armada-docker-build-gate-ubuntu_bionic
|
||||
- armada-docker-build-gate-ubuntu_xenial
|
||||
|
|
42
Makefile
42
Makefile
|
@ -54,55 +54,46 @@ info:
|
|||
@echo "Docker Version: ${DOCKER_VERSION}"
|
||||
@echo "Registry: ${DOCKER_REGISTRY}"
|
||||
|
||||
.PHONY: all
|
||||
all: lint charts images
|
||||
|
||||
.PHONY: build
|
||||
bashate:
|
||||
tox --notest -ebashate
|
||||
|
||||
build: bootstrap
|
||||
$(PYTHON) setup.py install
|
||||
|
||||
.PHONY: bootstrap
|
||||
bootstrap:
|
||||
pip install -r requirements.txt
|
||||
|
||||
.PHONY: bootstrap-all
|
||||
bootstrap-all: bootstrap
|
||||
pip install -r test-requirements.txt
|
||||
|
||||
.PHONY: check-docker
|
||||
check-docker:
|
||||
@if [ -z $$(which docker) ]; then \
|
||||
echo "Missing \`docker\` client which is required for development"; \
|
||||
exit 2; \
|
||||
fi
|
||||
|
||||
.PHONY: check-tox
|
||||
check-tox:
|
||||
@if [ -z $$(which tox) ]; then \
|
||||
echo "Missing \`tox\` client which is required for development"; \
|
||||
exit 2; \
|
||||
fi
|
||||
|
||||
.PHONY: images
|
||||
images: check-docker build_armada
|
||||
|
||||
.PHONY: docs
|
||||
docs: clean build_docs
|
||||
|
||||
.PHONY: build_docs
|
||||
build_docs:
|
||||
tox -e docs
|
||||
|
||||
.PHONY: run_images
|
||||
run_images: run_armada
|
||||
|
||||
.PHONY: run_armada
|
||||
run_armada: build_armada
|
||||
./tools/armada_image_run.sh $(IMAGE)
|
||||
|
||||
_BASE_IMAGE_ARG := $(if $(UBUNTU_BASE_IMAGE),--build-arg FROM="${UBUNTU_BASE_IMAGE}" ,)
|
||||
|
||||
.PHONY: build_armada
|
||||
build_armada:
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) \
|
||||
|
@ -130,11 +121,9 @@ ifeq ($(PUSH_IMAGE), true)
|
|||
endif
|
||||
|
||||
# make tools
|
||||
.PHONY: protoc
|
||||
protoc:
|
||||
@tools/helm-hapi.sh
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf build
|
||||
rm -rf doc/build
|
||||
|
@ -143,74 +132,63 @@ clean:
|
|||
rm -rf charts/*/charts
|
||||
|
||||
# testing checks
|
||||
.PHONY: tests
|
||||
tests: check-tox
|
||||
tox
|
||||
|
||||
.PHONY: test-all
|
||||
test-all: check-tox helm_lint
|
||||
tox
|
||||
|
||||
.PHONY: test-unit
|
||||
test-unit: check-tox
|
||||
tox -e py35
|
||||
|
||||
.PHONY: test-coverage
|
||||
test-coverage: check-tox
|
||||
tox -e cover
|
||||
|
||||
.PHONY: test-bandit
|
||||
test-bandit: check-tox
|
||||
tox -e bandit
|
||||
|
||||
# style checks
|
||||
.PHONY: lint
|
||||
lint: test-pep8 helm_lint
|
||||
lint: test-pep8 helm_lint bashate
|
||||
|
||||
.PHONY: test-pep8
|
||||
test-pep8: check-tox
|
||||
tox -e pep8
|
||||
|
||||
chartbanner:
|
||||
@echo Building charts: $(CHARTS)
|
||||
|
||||
.PHONY: charts
|
||||
charts: $(CHARTS)
|
||||
@echo Done building charts.
|
||||
|
||||
.PHONY: helm-init
|
||||
helm-init: $(addprefix helm-init-,$(CHARTS))
|
||||
|
||||
.PHONY: helm-init-%
|
||||
helm-init-%: helm-serve
|
||||
@echo Initializing chart $*
|
||||
cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi
|
||||
|
||||
.PHONY: helm-serve
|
||||
helm-serve: helm-install
|
||||
./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE)
|
||||
|
||||
.PHONY: helm-lint
|
||||
helm-lint: $(addprefix helm-lint-,$(CHARTS))
|
||||
|
||||
.PHONY: helm-lint-%
|
||||
helm-lint-%: helm-init-%
|
||||
@echo Linting chart $*
|
||||
cd charts;$(HELM) lint $*
|
||||
|
||||
.PHONY: dry-run
|
||||
dry-run: clean $(addprefix dry-run-,$(CHARTS))
|
||||
|
||||
.PHONY: dry-run-%
|
||||
dry-run-%: helm-lint-%
|
||||
echo Running Dry-Run on chart $*
|
||||
cd charts;$(HELM) template --set pod.resources.enabled=true $*
|
||||
|
||||
.PHONY: $(CHARTS)
|
||||
$(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner
|
||||
$(HELM) package -d charts charts/$@
|
||||
|
||||
# Install helm binary
|
||||
.PHONY: helm-install
|
||||
helm-install:
|
||||
./tools/helm_install.sh $(HELM)
|
||||
|
||||
.PHONY $(CHARTS) all bashate bootstrap bootstrap-all build build_armada \
|
||||
build_docs charts check-docker check-tox clean docs dry-run dry-run-% \
|
||||
helm-init helm-init-% helm-install helm-lint helm-lint-% helm-serve images \
|
||||
lint protoc run_armada run_images test-all test-bandit test-coverage \
|
||||
test-pep8 tests test-unit
|
||||
|
|
11
tox.ini
11
tox.ini
|
@ -1,7 +1,7 @@
|
|||
[tox]
|
||||
skipsdist = True
|
||||
minversion = 2.3.1
|
||||
envlist = py35, pep8, cover, bandit
|
||||
envlist = py35, pep8, cover, bandit, bashate
|
||||
|
||||
[testenv]
|
||||
deps=
|
||||
|
@ -81,6 +81,15 @@ basepython = python3
|
|||
commands =
|
||||
bandit -r armada -n 5 -x armada/tests/*
|
||||
|
||||
[testenv:bashate]
|
||||
basepython = python3
|
||||
deps = bashate
|
||||
whitelist_externals = bash
|
||||
commands = bash -c "find {toxinidir} \
|
||||
-not \( -type d -name .?\* -prune \) \
|
||||
-type f -name \*.sh \
|
||||
-print0 | xargs -0 bashate -v"
|
||||
|
||||
[testenv:cover]
|
||||
basepython = python3
|
||||
setenv = {[testenv]setenv}
|
||||
|
|
Loading…
Reference in New Issue