This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 436ce690c6dca730f9fdf6e3cd831d53c48ab474 (commit)
from 1b561174b1eca8fe2fca2586313d324d19e08dd9 (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 -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/436ce690c6dca730f9fdf6e3cd831d53c48ab474
commit 436ce690c6dca730f9fdf6e3cd831d53c48ab474
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Wed Oct 13 14:06:00 2010 -0400
New tests for autostart and "headless operation"
t/Makefile.am: added new "auto" test
t/auto: new
t/basic: added headless test, fixed bug in waiting for mongod to start
t/init.cfg: changed ports we use to avoid the mongo/auto defaults
auto.c: added --pidfilepath so tests can get mongod PID
diff --git a/auto.c b/auto.c
index a0e0b21..01521d6 100644
--- a/auto.c
+++ b/auto.c
@@ -30,6 +30,7 @@ static char *auto_arg_mongod[] = {
/* "--fork", */ /* chdirs god knows where, we cannot use this. */
/* "--logpath", AUTO_MONGOD_LOG, */ /* required by --fork */
/* "--logappend", */
+ "--pidfilepath", "mongo.pid",
NULL
};
@@ -39,6 +40,7 @@ static char *auto_arg_mongod_quiet[] = {
"--port", auto_arg_port,
"--dbpath", AUTO_DIR_DB,
"--logpath", AUTO_MONGOD_LOG,
+ "--pidfilepath", "mongo.pid",
NULL
};
diff --git a/t/Makefile.am b/t/Makefile.am
index 31a0e92..91f0ad4 100644
--- a/t/Makefile.am
+++ b/t/Makefile.am
@@ -17,7 +17,8 @@
TESTS = basic replication - parser-test
+ parser-test + auto
EXTRA_DIST = $(TESTS) diff --git a/t/auto b/t/auto
new file mode 100644
index 0000000..86efade
--- /dev/null
+++ b/t/auto
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Test autostart functionality.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ..
+
+mkdir iwhd || framework_failure_ mkdir failed
+
+port=9094
+m_port=27018 # auto-start default
+
+printf '[{"path": "FS", "type": "fs",
"name": "primary"}]n' + > iwhd.cfg || fail=1
+
+# Make sure specifying both -a and -c fails.
+iwhd -v -a -c iwhd.cfg && fail=1
+
+# Make sure specifying *neither* fails.
+iwhd -v && fail=1
+
+# Start for real.
+iwhd -v -p $port -a &
+iwhd_pid=$!
+cleanup_() { kill $iwhd_pid; }
+
+# Wait for up to 3 seconds for mongod to begin listening.
+wait_for .1 30 'mongo localhost:$m_port < /dev/null' + || framework_failure_
mongod failed to start
+# Wait for up to 3 seconds for iwhd to begin listening on $port.
+wait_for .1 30 "curl -s
http://localhost:$port" + || framework_failure_ iwhd
failed to start
+
+mongo_pid=$(cat mongo.pid)
+echo "mongo_pid = $mongo_pid"
+cleanup_() { kill $iwhd_pid; kill -9 $mongo_pid; }
+
+# Create an empty bucket.
+curl -X PUT
http://localhost:$port/b1 || fail=1
+test -d _fs/b1 || fail=1
+
+# Create a file in that bucket.
+echo foo | curl -T -
http://localhost:$port/b1/f1 || fail=1
+# Test presence in the FS.
+test -f _fs/b1/f1 || fail=1
+test "$(cat _fs/b1/f1)" = foo || fail=1
+# Test through the API as well.
+curl
http://localhost:$port/b1/f1 > f1copy
+test "$(cat f1copy)" = foo || fail=1
+
+# Delete an object.
+curl -X DELETE
http://localhost:$port/b1/f1 || fail=1
+# Ensure that it's gone from the file system.
+test -f _fs/b1/f1 && fail=1
+# Ensure that it's gone in the API as well.
+curl -f
http://localhost:$port/b1/f1 > /dev/null 2> del_object.err
+grep ' 404$' del_object.err || fail=1
+
+Exit $fail
diff --git a/t/basic b/t/basic
index 4dac5e9..2ea2fcd 100644
--- a/t/basic
+++ b/t/basic
@@ -12,7 +12,7 @@ mongo_pid=$!
cleanup_() { kill -9 $mongo_pid; }
# Wait for up to 3 seconds for mongod to begin listening.
-wait_for .1 30 'mongo < /dev/null' +wait_for .1 30 'mongo
localhost:$m_port < /dev/null' || framework_failure_ mongod failed to start
port=9091
@@ -264,6 +264,12 @@ for attr in bucket key date etag loc; do
grep ' 400$' bad_attr.err || fail=1
done
+# Test "headless" operation (no access to metadata DB).
+kill -9 $mongo_pid
+cleanup_() { kill $iwhd_pid; }
+curl $bucket/f3 > f3copy
+test "$(cat f3copy)" = "nothing" || fail=1
+
# TBD: add attribute-delete tests when that functionality is implemented
# TBD: add white-box tests for attributes in mongo
diff --git a/t/init.cfg b/t/init.cfg
index 1fa2bb6..bffe669 100644
--- a/t/init.cfg
+++ b/t/init.cfg
@@ -15,7 +15,8 @@ curl() { env curl -q -s -S "$@"; }
# m_port=$(expr $mongo_base_port + DDD)
# And then start mongod on that port and specify iwhd's DB host
# using --db=localhost:$m_port.
-mongo_base_port=27017
+# Avoid the built-in and auto-start defaults (27017 and 27018 respectively)
+mongo_base_port=27019
wait_for()
{
-----------------------------------------------------------------------
Summary of changes:
auto.c | 2 ++
t/Makefile.am | 3 ++-
t/auto | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
t/basic | 8 +++++++-
t/init.cfg | 3 ++-
5 files changed, 70 insertions(+), 3 deletions(-)
create mode 100644 t/auto
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")