Module: check_mk
Branch: master
Commit: ddaa797d0ea9c91c7e7ba06a30b555f3fdbebfdc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ddaa797d0ea9c9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 14 11:40:49 2016 +0100
GUI crawl test does not involve the system apache anymore
Change-Id: Ibfd6f162ac1045ae7ab20c1b1d9aa6b90092783f
---
tests/testlib/__init__.py | 9 +++++++++
tests/web/test_crawl.py | 6 +++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 2f1b5c7..9776de4 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -167,6 +167,15 @@ class Site(object):
@property
+ def apache_port(self):
+ return int(self.get_config("APACHE_TCP_PORT"))
+
+
+ @property
+ def internal_url(self):
+ return "%s://%s:%s/%s/check_mk/" % (self.http_proto, self.http_address,
self.apache_port, self.id)
+
+ @property
def livestatus_port(self):
if self._livestatus_port == None:
raise Exception("Livestatus TCP not opened yet")
diff --git a/tests/web/test_crawl.py b/tests/web/test_crawl.py
index 32a178f..7af4a68 100644
--- a/tests/web/test_crawl.py
+++ b/tests/web/test_crawl.py
@@ -190,7 +190,7 @@ class Worker(threading.Thread):
for element in elements:
orig_url = element.get(attr)
- url = self.normalize_url(self.crawler.site.url, orig_url)
+ url = self.normalize_url(self.crawler.site.internal_url, orig_url)
if url is not None and self.is_valid_url(url) \
and url not in self.crawler.visited:
@@ -214,7 +214,7 @@ class Worker(threading.Thread):
return False
# skip external urls
- if url.startswith("http://") and not
url.startswith(self.crawler.site.url):
+ if url.startswith("http://") and not
url.startswith(self.crawler.site.internal_url):
#print("Skipping external URL: %s" % url)
return False
@@ -283,7 +283,7 @@ class TestCrawler(object):
self.load_stats()
- self.todo.put(Url("/%s/check_mk/" % site.id))
+ self.todo.put(Url(site.internal_url))
self.crawl()