BIND 10 trac1897, updated. eb1b9e524157d9c378ba0350fe3217d56dbc0665 [1897] Add lettuce test for stats-http response/log

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jan 23 11:09:33 UTC 2013


The branch, trac1897 has been updated
       via  eb1b9e524157d9c378ba0350fe3217d56dbc0665 (commit)
      from  769bbb5edb0fe537e497ebe1a9fc3dfc130a5866 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit eb1b9e524157d9c378ba0350fe3217d56dbc0665
Author: Jelte Jansen <jelte at isc.org>
Date:   Wed Jan 23 12:09:17 2013 +0100

    [1897] Add lettuce test for stats-http response/log

-----------------------------------------------------------------------

Summary of changes:
 tests/lettuce/features/stats_httpd.feature         |   16 ++++++++++
 .../lettuce/features/terrain/http.py               |   31 ++++++++++++--------
 tests/lettuce/features/terrain/terrain.py          |    4 +++
 3 files changed, 38 insertions(+), 13 deletions(-)
 create mode 100644 tests/lettuce/features/stats_httpd.feature
 copy src/lib/python/isc/testutils/parse_args.py => tests/lettuce/features/terrain/http.py (51%)

-----------------------------------------------------------------------
diff --git a/tests/lettuce/features/stats_httpd.feature b/tests/lettuce/features/stats_httpd.feature
new file mode 100644
index 0000000..7c8e125
--- /dev/null
+++ b/tests/lettuce/features/stats_httpd.feature
@@ -0,0 +1,16 @@
+Feature: b10-stats-httpd module
+    Tests the stats httpd module
+
+    Scenario: Check that the module logs and responds to requests
+    Given I have bind10 running with configuration bindctl_commands.config
+    And wait for bind10 stderr message STATHTTPD_STARTED
+
+    When I request the URL http://127.0.0.1:47811/
+    # Should result in redirect, so two query logs
+    And wait for new bind10 stderr message localhost "GET / HTTP/1.0" 302 -
+    And wait for new bind10 stderr message localhost "GET /bind10/statistics/xml/ HTTP/1.0" 200 -
+    The last http response status code should be 200
+
+    When I request the URL http://127.0.0.1:47811/no_such_url
+    And wait for new bind10 stderr message localhost "GET /no_such_url HTTP/1.0" 404 -
+    The last http response status code should be 404
diff --git a/tests/lettuce/features/terrain/http.py b/tests/lettuce/features/terrain/http.py
new file mode 100644
index 0000000..31fa2d4
--- /dev/null
+++ b/tests/lettuce/features/terrain/http.py
@@ -0,0 +1,35 @@
+# Copyright (C) 2013  Internet Systems Consortium.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+from lettuce import *
+import urllib
+
+# Basic request
+ at step('request the URL (.*)')
+def request_url(step, url):
+    """
+    Performs one basic HTTP GET request. The resulting HTTPResponse object
+    will we placed in world.last_http_response
+    Parameters:
+    url: the full URL to query
+    """
+    world.last_http_response = urllib.urlopen(url)
+
+ at step('last http response status code should be ([0-9]+)')
+def check_last_response_code(step, code):
+    assert world.last_http_response != None, "No HTTP request made yet"
+    assert int(code) == world.last_http_response.getcode(),\
+                        code + " != " +\
+                        str(world.last_http_response.getcode())
diff --git a/tests/lettuce/features/terrain/terrain.py b/tests/lettuce/features/terrain/terrain.py
index bc05341..6af5c16 100644
--- a/tests/lettuce/features/terrain/terrain.py
+++ b/tests/lettuce/features/terrain/terrain.py
@@ -1,3 +1,4 @@
+
 # Copyright (C) 2011  Internet Systems Consortium.
 #
 # Permission to use, copy, modify, and distribute this software for any
@@ -380,6 +381,9 @@ def initialize(scenario):
     # Convenience variable to access the last query result from querying.py
     world.last_query_result = None
 
+    # Convenience variable to access the last HTTP response from http.py
+    world.last_http_response = None
+
     # For slightly better errors, initialize a process_pids for the relevant
     # steps
     world.process_pids = None



More information about the bind10-changes mailing list