diff --git a/Makefile b/Makefile index 7f5d8f0..bebb74c 100644 --- a/Makefile +++ b/Makefile @@ -11,49 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -UID:=`id -u` -GID:=`id -g` -ITERATION=yelp1 - -.PHONY: test tests coverage clean - - +.PHONY: test test: tox - -tests: test -coverage: test - -itest_%: package_% - docker run -h fake.docker.hostname -v $(CURDIR):/work:rw docker-dev.yelpcorp.com/$*_yelp /bin/bash -c "/work/tests/ubuntu.sh" - docker run -v $(CURDIR):/work:rw docker-dev.yelpcorp.com/$*_yelp chown -R $(UID):$(GID) /work - -package_%: - mkdir -p dist - docker run \ - -h fake.docker.hostname \ - -v $(CURDIR):/work:rw \ - docker-dev.yelpcorp.com/$*_pkgbuild \ - /bin/bash -c 'cd /work && \ - fpm --force \ - -s python -t deb \ - -m "Compute Infrastructure " \ - --deb-user "root" --deb-group "root" \ - --python-pypi "https://pypi.yelpcorp.com/simple" \ - --python-install-lib "/usr/lib/python2.7/dist-packages" \ - --python-install-bin "/usr/bin" \ - --python-install-data "/usr" \ - --no-python-dependencies \ - --depends "python-yaml > 3.0" \ - --deb-no-default-config-files \ - --iteration="$(ITERATION)" . && \ - mv *.deb dist/ \ - ' - docker run -v $(CURDIR):/work:rw docker-dev.yelpcorp.com/$*_yelp chown -R $(UID):$(GID) /work - venv: requirements.txt setup.py tox.ini tox -e venv +.PHONY: clean clean: rm -rf .cache rm -rf dist/ diff --git a/requirements-dev.txt b/requirements-dev.txt index 61b4459..7d90251 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,10 +1,7 @@ -# Coverage==5.0 fails with `Safety level may not be changed inside a transaction` -# on python 3.6.0 (xenial) (https://github.com/nedbat/coveragepy/issues/703) -coverage<5 +coverage mock mypy -pre-commit==1.21.0 +pre-commit pytest types-PyYAML -# To resolve the error: types-requests 2.31.0.6 has requirement urllib3>=2, but you'll have urllib3 1.26.15 which is incompatible. -types-requests==2.31.0.5 +types-requests diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d0f2f35..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -importlib-resources==5.4.0 -pyinotify==0.9.6 -pyyaml >= 3.0 -# To resolve the error: botocore 1.29.125 has requirement urllib3<1.27,>=1.25.4, but you'll have urllib3 2.0.1 which is incompatible. -urllib3==1.26.15 diff --git a/tests/ubuntu.sh b/tests/ubuntu.sh deleted file mode 100755 index c5628a2..0000000 --- a/tests/ubuntu.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# Copyright 2015 Yelp Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -set -e - -SCRIPTS="all_nodes_that_receive -all_nodes_that_run -dump_service_configuration_yaml -services_deployed_here -services_needing_puppet_help -services_that_run_here" - -SERVICES_DEPLOYED="fake_runs_on_1 -fake_runs_on_2 -fake_deploys_on_1 -fake_deploys_on_2" - -SERVICES_RUN="fake_runs_on_1 -fake_runs_on_2" - -SERVICES_PUPPET="fake_runs_on_1 -fake_deploys_on_1" - -SERVICES_NOTHING="fake_total_bunk" - -# We need to get the fake services folder to look -# like it's the real services config folder -mkdir -p /nail/etc -[ -L /nail/etc/services ] || ln -s /work/tests/fake_services /nail/etc/services - -apt-get update -DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gdebi-core - -if gdebi -n /work/dist/*.deb; then - echo "Package installed correctly..." -else - echo "Dpkg install failed!" - exit 1 -fi - -if python -c 'import service_configuration_lib' >/dev/null; then - echo "Library can be imported..." -else - echo "Package installed but library failed to import!" - exit 1 -fi - -for scr in $SCRIPTS -do - which $scr >/dev/null || (echo "$scr failed to install!"; exit 1) -done -echo "All scripts are in the path..." - -for srv in $SERVICES_DEPLOYED -do - if ! services_deployed_here | grep -q $srv; then - echo "Service $srv ISN'T showing up in services_deployed_here but should be" - exit 1 - fi -done - -for srv in $SERVICES_RUN -do - if ! services_that_run_here | grep -q $srv; then - echo "Service $srv ISN'T showing up in services_that_run_here but should be" - exit 1 - fi -done - -for srv in $SERVICES_PUPPET -do - if ! services_needing_puppet_help | grep -q $srv; then - echo "Service $srv ISN'T showing up in services_needing_puppet_help but should be" - exit 1 - fi -done - -for srv in $SERVICES_NOTHING -do - if services_deployed_here | grep -q $srv; then - echo "Service $srv IS showing up in services_deployed_here but shouldn't be" - exit 1 - fi - if services_that_run_here | grep -q $srv; then - echo "Service $srv IS showing up in services_that_run_here but shouldn't be" - exit 1 - fi - if services_needing_puppet_help | grep -q $srv; then - echo "Service $srv IS showing up in services_needing_puppet_help but shouldn't be" - exit 1 - fi -done - -echo "Everything worked! Exiting..." diff --git a/tox.ini b/tox.ini index ae8a9df..4ad70f1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,9 @@ [tox] envlist = py37 -tox_pip_extensions_ext_pip_custom_platform = true -tox_pip_extensions_ext_venv_update = true [testenv] deps = -rrequirements-dev.txt - -rrequirements.txt commands= mypy service_configuration_lib coverage erase