summaryrefslogtreecommitdiffstats
path: root/test/createinstance.sh
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2014-02-26 16:37:51 -0500
committerRob Crittenden <rcritten@redhat.com>2014-02-26 16:50:55 -0500
commit07c27296c2c940cb119386304ebffb4ab41f0fb9 (patch)
tree201d87fb7f87d734bcec06aef66d8f20d8fb4706 /test/createinstance.sh
parentc2ac0d128e776f3edb8aeb8920bf41b99742e74c (diff)
Add some basic functional tests.
This tests in an in-tree Apache instance using the local libmodnss.so shared library, so no pre-installation is necessary. The tests use python-nose and a hacked python-requests library. It is hacked so I can obtain the negotiated cipher and protocol as well as pass a few other things into it. Tests right now are limited to GET requests. A new user certificate for 'beta' was added to gencert to do pass/fail access control testing. The basic process of the tests are: - run setup.sh which sets up a new instance with createinstance.sh and does some variable substitution. - nosetests -v I picture multiple test "suites" of different configurations. Right now there is only one. A template file is provided for each suite. Tested only on Fedora 20 right now.
Diffstat (limited to 'test/createinstance.sh')
-rwxr-xr-xtest/createinstance.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/createinstance.sh b/test/createinstance.sh
new file mode 100755
index 0000000..1eaa644
--- /dev/null
+++ b/test/createinstance.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Make a temporary Apache instance for testing.
+
+if [ " $#" -eq 0 ]; then
+ echo "Usage: $0 /path/to/instance"
+ exit 1
+fi
+target=$1
+
+echo "Creating instance in $target"
+mkdir -p $target
+
+cd $target
+mkdir alias
+mkdir conf
+mkdir conf.d
+mkdir logs
+mkdir run
+mkdir content
+mkdir cgi-bin
+mkdir lib
+
+# Create the content
+mkdir content/rc4_cipher
+mkdir content/acl
+
+cat > content/index.html << EOF
+<html>
+Basic index page
+</html
+EOF
+cp content/index.html content/acl/aclS01.html
+cp content/index.html content/acl/aclS02.html
+cp content/index.html content/acl/aclS03.html
+cp content/index.html content/secret-test.html
+
+ln -s /etc/httpd/modules modules
+
+dn="E=alpha@`hostname`,CN=Frank Alpha,UID=alpha,OU=People,O=example.com,C=US"
+cat > conf/htpasswd << EOF
+/${dn}:xxj31ZMTZzkVA
+EOF
+
+# Create start/stop scripts
+
+cat << EOF > start
+#!/bin/sh
+HTTPD=/usr/sbin/httpd
+\$HTTPD -k start -d . -f ./conf/httpd.conf
+EOF
+
+cat << EOF > stop
+#!/bin/sh
+HTTPD=/usr/sbin/httpd
+\$HTTPD -k stop -d . -f ./conf/httpd.conf
+EOF
+
+chmod 0755 start stop