Browse Source

Staging tests for testing command-channel commands.

Shane Kerr 14 years ago
parent
commit
f73c46eb40
2 changed files with 47 additions and 32 deletions
  1. 47 0
      src/bin/bind10/tests/bind10_cmd_test.py
  2. 0 32
      src/bin/bind10/tests/bind10_test.in

+ 47 - 0
src/bin/bind10/tests/bind10_cmd_test.py

@@ -0,0 +1,47 @@
+"""
+This program checks the BIND 10 boss interaction.
+"""
+import unittest
+import subprocess
+import time
+import select
+import isc.cc
+
+BIND10_EXE="../run_bind10.sh"
+TIMEOUT=3
+
+class TestBossBindctl(unittest.TestCase):
+    def _waitForString(self, bob, s):
+        """Read the input from the Process object until we find the 
+        string we're looking for or we timeout."""
+        found_string = False
+        start_time = time.time()
+        while time.time() < start_time + TIMEOUT:
+            (r,w,x) = select.select((bob.stdout,), (), (), TIMEOUT) 
+            if bob.stdout in r:
+                s = bob.stdout.readline()
+                if s == '':
+                    break
+                if s.startswith(s): 
+                    found_string = True
+                    break
+        return found_string
+
+    def testBasicBindctl(self):
+        """Run basic bindctl"""
+        # start bind10
+        bob = subprocess.Popen(args=(BIND10_EXE,),
+                               stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        started_ok = self._waitForString(bob, '[bind10] BIND 10 started')
+
+        # connect to the command channel
+        self.cc = isc.cc.Session()
+
+        # shut down 
+        bob.terminate()
+        bob.wait()
+
+
+if __name__ == '__main__':
+    unittest.main()
+

+ 0 - 32
src/bin/bind10/tests/bind10_test.in

@@ -1,32 +0,0 @@
-#! /bin/sh
-
-# Copyright (C) 2010  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.
-
-PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@}
-export PYTHON_EXEC
-
-BIND10_PATH=@abs_top_srcdir@/src/bin/bind10
-
-PATH=@abs_top_srcdir@/src/bin/msgq:@abs_top_srcdir@/src/bin/auth:@abs_top_srcdir@/src/bin/bind-cfgd:$PATH
-export PATH
-
-PYTHONPATH=@abs_top_srcdir@/src/lib/python:@abs_top_srcdir@/src/bin/bind10
-export PYTHONPATH
-
-cd ${BIND10_PATH}/tests
-${PYTHON_EXEC} -O bind10_test.py $*
-exec ${PYTHON_EXEC} -O args_test.py $*
-