diff --git a/.gitlab-ci.jsonnet b/.gitlab-ci.jsonnet index e39933e8f..8ea50c70f 100644 --- a/.gitlab-ci.jsonnet +++ b/.gitlab-ci.jsonnet @@ -85,7 +85,7 @@ local jobs = { }, 'registry-tests': unittest_stage { - script: [ pytest_cmd + ' ./test/registry_tests.py'], + script: [ pytest_cmd + ' ./test/registry/registry_tests.py'], coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/", }, diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 18f69eb0f..66c898294 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -292,7 +292,7 @@ registry-tests: coverage: /^TOTAL.*\s+(\d+\%)\s*$/ image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} script: - - py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./test/registry_tests.py + - py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./test/registry/registry_tests.py stage: tests tags: - kubernetes diff --git a/Dockerfile.old b/Dockerfile.old deleted file mode 100644 index 191a5cafe..000000000 --- a/Dockerfile.old +++ /dev/null @@ -1,189 +0,0 @@ -# vim:ft=dockerfile - -FROM phusion/baseimage:0.9.19 - -ENV DEBIAN_FRONTEND noninteractive -ENV HOME /root -ENV QUAYCONF /quay/conf -ENV QUAYDIR /quay -ENV QUAYPATH "." - -RUN mkdir $QUAYDIR -WORKDIR $QUAYDIR - -# This is so we don't break http golang/go#17066 -# When Ubuntu has nginx >= 1.11.0 we can switch back. -RUN add-apt-repository ppa:nginx/development - -# Add Yarn repository until it is officially added to Ubuntu -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - -RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list - -# Install system packages -RUN apt-get update && apt-get upgrade -y # 26MAY2017 -RUN apt-get install -y \ - dnsmasq \ - g++ \ - gdb \ - gdebi-core \ - git \ - jpegoptim \ - libevent-2.0.5 \ - libevent-dev \ - libffi-dev \ - libfreetype6-dev \ - libgpgme11 \ - libgpgme11-dev \ - libjpeg62 \ - libjpeg62-dev \ - libjpeg8 \ - libldap-2.4-2 \ - libldap2-dev \ - libmagic1 \ - libpq-dev \ - libpq5 \ - libsasl2-dev \ - libsasl2-modules \ - monit \ - nginx \ - nodejs \ - optipng \ - openssl \ - python-dbg \ - python-dev \ - python-pip \ - python-virtualenv \ - yarn=0.22.0-1 \ - w3m - -# Install python dependencies - -ADD requirements.txt requirements.txt -RUN virtualenv --distribute venv -RUN venv/bin/pip install -r requirements.txt # 07SEP2016 -RUN venv/bin/pip freeze - -# Check python dependencies for the GPL -# Due to the following bug, pip results must be piped to a file before grepping: -# https://github.com/pypa/pip/pull/3304 -RUN cat requirements.txt | grep -v "^-e" | awk -F'==' '{print $1}' | xargs venv/bin/pip --disable-pip-version-check show > pipinfo.txt && \ - test -z $(cat pipinfo.txt | grep GPL | grep -v LGPL) && \ - rm pipinfo.txt - -# Install cfssl -RUN mkdir /gocode -ENV GOPATH /gocode -RUN curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz && \ - tar -xvf go1.6.linux-amd64.tar.gz && \ - mv go /usr/local && \ - rm -rf go1.6.linux-amd64.tar.gz && \ - /usr/local/go/bin/go get -u github.com/cloudflare/cfssl/cmd/cfssl && \ - /usr/local/go/bin/go get -u github.com/cloudflare/cfssl/cmd/cfssljson && \ - cp /gocode/bin/cfssljson /bin/cfssljson && \ - cp /gocode/bin/cfssl /bin/cfssl && \ - rm -rf /gocode && rm -rf /usr/local/go - -# Install jwtproxy -RUN curl -L -o /usr/local/bin/jwtproxy https://github.com/coreos/jwtproxy/releases/download/v0.0.1/jwtproxy-linux-x64 -RUN chmod +x /usr/local/bin/jwtproxy - -# Install prometheus-aggregator -RUN curl -L -o /usr/local/bin/prometheus-aggregator https://github.com/coreos/prometheus-aggregator/releases/download/v0.0.1-alpha/prometheus-aggregator -RUN chmod +x /usr/local/bin/prometheus-aggregator - -# Install front-end dependencies -RUN ln -s /usr/bin/nodejs /usr/bin/node -ADD package.json package.json -ADD tsconfig.json tsconfig.json -ADD webpack.config.js webpack.config.js -ADD yarn.lock yarn.lock -RUN yarn install --ignore-engines - -# Add static files -ADD static static - -# Run Webpack -RUN yarn build - -# Optimize our images -ADD static/img static/img -RUN jpegoptim static/img/**/*.jpg -RUN optipng -clobber -quiet static/img/**/*.png - -RUN apt-get remove -y --auto-remove python-dev g++ libjpeg62-dev libevent-dev libldap2-dev libsasl2-dev libpq-dev libffi-dev libgpgme11-dev nodejs jpegoptim optipng w3m -RUN apt-get autoremove -y -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Set up the init system -ADD conf/init/copy_config_files.sh /etc/my_init.d/ -ADD conf/init/doupdatelimits.sh /etc/my_init.d/ -ADD conf/init/copy_syslog_config.sh /etc/my_init.d/ -ADD conf/init/certs_create.sh /etc/my_init.d/ -ADD conf/init/certs_install.sh /etc/my_init.d/ -ADD conf/init/nginx_conf_create.sh /etc/my_init.d/ -ADD conf/init/runmigration.sh /etc/my_init.d/ -ADD conf/init/syslog-ng.conf /etc/syslog-ng/ -ADD conf/init/zz_boot.sh /etc/my_init.d/ -ADD conf/init/service/ /etc/service/ -RUN rm -rf /etc/service/syslog-forwarder - -ADD conf/kill-buildmanager.sh /usr/local/bin/kill-buildmanager.sh -ADD conf/monitrc /etc/monit/monitrc -RUN chmod 0600 /etc/monit/monitrc - -# remove after phusion/baseimage-docker#338 is fixed -ADD conf/init/logrotate.conf /etc/logrotate.conf - -# TODO(ssewell): only works on a detached head, make work with ref -ADD .git/HEAD GIT_HEAD - -# Add all of the files! -ADD . . -RUN mkdir static/fonts static/ldn - -# Download any external libs. -RUN venv/bin/python -m external_libraries -RUN mkdir -p /usr/local/nginx/logs/ - - -RUN pyclean . - -# Cleanup any NPM-related stuff. -RUN rm -rf /root/.npm -RUN rm -rf .npm -RUN rm -rf /usr/local/lib/node_modules -RUN rm -rf /usr/share/yarn/node_modules -RUN rm -rf /root/node_modules -RUN rm -rf node_modules -RUN rm -rf grunt -RUN rm package.json yarn.lock - -# Run the tests -ARG RUN_TESTS=true -ENV RUN_TESTS ${RUN_TESTS} - -ENV RUN_ACI_TESTS False -ADD requirements-tests.txt requirements-tests.txt - -RUN if [ "$RUN_TESTS" = true ]; then \ - venv/bin/pip install -r requirements-tests.txt ;\ - fi - -RUN if [ "$RUN_TESTS" = true ]; then \ - TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \ - --show-count -x --color=no ./ && rm -rf /var/tmp/; \ - fi - -RUN if [ "$RUN_TESTS" = true ]; then \ - TEST=true PYTHONPATH="." venv/bin/py.test --timeout=7200 --verbose \ - --show-count -x --color=no test/registry_tests.py && rm -rf /var/tmp/;\ - - fi - -RUN rm -rf /root/.cache - -RUN PYTHONPATH=. venv/bin/alembic heads | grep -E '^[0-9a-f]+ \(head\)$' > ALEMBIC_HEAD - -VOLUME ["/conf/stack", "/var/log", "/datastorage", "/tmp", "/conf/etcd"] - -EXPOSE 443 8443 80 diff --git a/Makefile b/Makefile index 780ca4e77..a0f187ce3 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ registry-test: TEST=true PYTHONPATH="." py.test \ --cov="." --cov-report=html --cov-report=term-missing \ --timeout=3600 --verbose --show-count -x \ - test/registry_tests.py + test/registry/registry_tests.py test: unit-test registry-test diff --git a/README.md b/README.md index 43f1db291..26a0ff388 100644 --- a/README.md +++ b/README.md @@ -274,7 +274,7 @@ TEST=true python -m test.test_api_usage -f SuiteName TEST=true PYTHONPATH="." py.test --verbose # To run a specific test module -TEST=true PYTHONPATH="." py.test --verbose test/registry_tests.py +TEST=true PYTHONPATH="." py.test --verbose test/registry/registry_tests.py # To run a specific test unique test TEST=true PYTHONPATH="." py.test --verbose test/test_api_usage.py::TestDeleteNamespace diff --git a/ci/tasks/registry.yaml b/ci/tasks/registry.yaml index e27ba3cea..09095a73b 100644 --- a/ci/tasks/registry.yaml +++ b/ci/tasks/registry.yaml @@ -13,4 +13,4 @@ run: pip install --quiet -r quay-pull-request/requirements-tests.txt cd quay-pull-request PYTHONPATH="." py.test --timeout=7200 --verbose \ - --show-count -x test/registry_tests.py + --show-count -x test/registry/registry_tests.py diff --git a/test/registry/liveserverfixture.py b/test/registry/liveserverfixture.py index ec50daeeb..18185a5d1 100644 --- a/test/registry/liveserverfixture.py +++ b/test/registry/liveserverfixture.py @@ -68,14 +68,16 @@ class liveFlaskServer(object): start_time = time.time() while True: + time.sleep(0.1) + elapsed_time = (time.time() - start_time) if elapsed_time > timeout: raise RuntimeError("Failed to start the server after %d seconds. " % timeout) - if self._can_ping_server(): + if self._can_connect(): break - def _can_ping_server(self): + def _can_connect(self): host, port = self._get_server_address() if port == 0: # Port specified by the user was 0, and the OS has not yet assigned diff --git a/tox.ini b/tox.ini index 648cb2ccc..9a359fd53 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py27}-{unittest,registry} +envlist = {py27}-{unittest,registry,registry_old} skipsdist = True [testenv] @@ -11,7 +11,8 @@ deps = setenv = PYTHONPATH = {toxinidir}:{toxinidir} TEST=true - registry: FILE="test/registry_tests.py" + registry: FILE="test/registry/registry_tests.py" + registry_old: FILE="test/registry_tests.py" unittest: FILE="" commands = py.test --verbose {env:FILE} -vv {posargs}