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