Skip to content

Commit

Permalink
Fix phantomjs check
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 27, 2017
1 parent 3402897 commit ca6e348
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ jobs:

- env: [JOB=test-docker-app]
before_script:
- mkdir /tmp/travis
- docker build --tag=external-db docker/test-external-db
- travis/create-new-project.sh
- travis/run-on.sh /tmp/travis/testgeomapfish/ ./docker-run travis/empty-make.sh -f travis.mk help
Expand All @@ -118,9 +117,8 @@ jobs:
/tmp/travis/testgeomapfish/geoportal/testgeomapfish_geoportal/views
/tmp/travis/testgeomapfish/commons/setup.py /tmp/travis/testgeomapfish/commons/testgeomapfish_commons
-name \*.py | xargs travis/squote
# FIXME re-enhable them
#- travis/test-new-project http://localhost:8080/c2c/health_check
#- travis/test-new-project http://localhost:8080/c2c/health_check?max_level=100
- travis/test-new-project http://localhost:8080/c2c/health_check
- travis/test-new-project http://localhost:8080/c2c/health_check?max_level=100
- travis/test-new-project http://localhost:8080/layers/test/values/type enum
- travis/run-on.sh /tmp/travis/testgeomapfish/ docker-compose logs
- travis/run-on.sh /tmp/travis/testgeomapfish/ docker-compose down
Expand Down
3 changes: 2 additions & 1 deletion geoportal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ COPY . /opt/c2cgeoportal_geoportal
RUN chmod go+r -R /opt/c2cgeoportal_geoportal && \
pip install --disable-pip-version-check --no-cache-dir --no-deps --editable=/opt/c2cgeoportal_geoportal

ENV LOG_LEVEL=INFO \
ENV NODE_PATH=/usr/lib/node_modules \
LOG_LEVEL=INFO \
GUNICORN_ACCESS_LOG_LEVEL=INFO \
C2CGEOPORTAL_LOG_LEVEL=WARN
13 changes: 10 additions & 3 deletions geoportal/c2cgeoportal_geoportal/lib/check_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.
import logging

import requests

from c2cgeoportal_geoportal.lib.checker import build_url

LOG = logging.getLogger(__name__)


def init(config, health_check):
global_settings = config.get_settings()
Expand All @@ -47,9 +50,13 @@ def check(request):
display = host["display"]
if "host" not in params or display == params["host"]:
url_headers = build_url(
"check_collector", "%s%s/health_check" % (host["url"], c2c_base), request)
"check_collector", "%s%s/health_check" % (host["url"], c2c_base), request
)
r = requests.get(params={"max_level": str(host.get("max_level", max_level))}, **url_headers)
r.raise_for_status()

health_check.add_custom_check(name="check_collector_" + host["display"], check_cb=check,
level=settings["level"])
health_check.add_custom_check(
name="check_collector_" + host["display"],
check_cb=check,
level=settings["level"]
)
5 changes: 3 additions & 2 deletions geoportal/c2cgeoportal_geoportal/lib/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def build_url(name, url, request, headers=None):
else:
url_ = url

log.error("{}, URL: {} => {}".format(name, url, url_))
log.error("%s, URL: %s => %s", name, url, url_)
return {"url": url_, "headers": headers}


Expand Down Expand Up @@ -207,7 +207,8 @@ def check(request):

cmd = [
"phantomjs", "--local-to-remote-url-access=true",
"/usr/lib/node_modules/ngeo/buildtools/check-example.js", url]
"/usr/lib/node_modules/ngeo/buildtools/check-example.js", url
]

# check_output throws a CalledProcessError if return code is > 0
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ vars:
root_dir: "{directory}"

# used for the "node_modules" and "closure" static views
closure_library_path: 'process.stdout.write(require("closure-util").getLibraryPath())'
closure_library_path: 'process.stdout.write(require("@camptocamp/closure-util").getLibraryPath())'
node_modules_path: "/usr/lib/node_modules"

# pyramid_closure configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def main():
for package in [
"angular-jsdoc",
"angular-mocks",
"console-control-strings",
"coveralls",
"gaze",
"jsdoc",
Expand Down
1 change: 0 additions & 1 deletion travis/create-new-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ git remote add origin . # add a fake remote
./docker-run make --makefile=travis.mk \
docker-compose-build.yaml \
geoportal-docker mapserver-docker print-docker testdb-docker
cat docker-compose-build.yaml
# Wait DB
./docker-compose-run sleep 15
# Create default theme
Expand Down

0 comments on commit ca6e348

Please sign in to comment.