Skip to content

Commit

Permalink
Start improving tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rescrv committed Aug 18, 2015
1 parent f9bb07d commit 870cbcd
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 61 deletions.
63 changes: 31 additions & 32 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ TESTS =

gperf_verbose = $(gperf_verbose_$(V))
gperf_verbose_ = $(gperf_verbose_$(AM_DEFAULT_VERBOSITY))
gperf_verbose_0 = @echo " GPERF " $@;
gperf_verbose_0 = @echo " GPERF " $@;
help2man_verbose = $(help2man_verbose_$(V))
help2man_verbose_ = $(help2man_verbose_$(AM_DEFAULT_VERBOSITY))
help2man_verbose_0 = @echo " MAN " $@;
help2man_verbose_0 = @echo " MAN " $@;
pandoc_verbose = $(pandoc_verbose_$(V))
pandoc_verbose_ = $(pandoc_verbose_$(AM_DEFAULT_VERBOSITY))
pandoc_verbose_0 = @echo " PANDOC" $@;
pandoc_verbose_0 = @echo " PANDOC " $@;
pyx_verbose = $(pyx_verbose_$(V))
pyx_verbose_ = $(pyx_verbose_$(AM_DEFAULT_VERBOSITY))
pyx_verbose_0 = @echo " PYX " $@;
sed_verbose = $(sed_verbose_$(V))
sed_verbose_ = $(sed_verbose_$(AM_DEFAULT_VERBOSITY))
sed_verbose_0 = @echo " SED " $@;
sed_verbose_0 = @echo " SED " $@;

th_sources = test/th_main.cc test/th.cc test/th.h

Expand Down Expand Up @@ -801,16 +801,27 @@ check_PROGRAMS += test/replication-stress-test
check_PROGRAMS += test/search-stress-test
check_PROGRAMS += test/simple-consistency-stress-test

shell_wrappers =

doctest_wrappers =
doctest_wrappers += test/sh/doc.quick-start.sh
doctest_wrappers += test/sh/doc.data-types.sh
doctest_wrappers += test/sh/doc.documents.sh
doctest_wrappers += test/sh/doc.async-ops.sh
doctest_wrappers += test/sh/doc.atomic-ops.sh
doctest_wrappers += test/sh/doc.authorization.sh
shell_wrappers += $(doctest_wrappers)
EXTRA_DIST += test/env.sh
EXTRA_DIST += test/runner.py
EXTRA_DIST += test/gremlin/5-node-cluster

doctest_gremlins =
doctest_gremlins += test/gremlin/doc.quick-start
doctest_gremlins += test/gremlin/doc.data-types
doctest_gremlins += test/gremlin/doc.async-ops
doctest_gremlins += test/gremlin/doc.atomic-ops
doctest_gremlins += test/gremlin/doc.documents
doctest_gremlins += test/gremlin/doc.authorization
EXTRA_DIST += $(doctest_gremlins)
EXTRA_DIST += test/doc.async-ops.py
EXTRA_DIST += test/doc.atomic-ops.py
EXTRA_DIST += test/doc.authorization.py
EXTRA_DIST += test/doc.data-types.py
EXTRA_DIST += test/doc.documents.py
EXTRA_DIST += test/doc-extract.py
EXTRA_DIST += test/doc.mongo.py
EXTRA_DIST += test/doc.quick-start.py
EXTRA_DIST += test/doctest-runner.py

stress_wrappers =
stress_wrappers += test/sh/replication.simple.daemons=1.fault-tolerance=0.sh
Expand Down Expand Up @@ -849,7 +860,7 @@ stress_wrappers += test/sh/search.combination.keytype=int,daemons=4.fault-tolera
stress_wrappers += test/sh/search.combination.keytype=string,daemons=1.fault-tolerance=0.sh
stress_wrappers += test/sh/search.combination.keytype=string,daemons=4.fault-tolerance=0.sh
stress_wrappers += test/sh/search.combination.keytype=string,daemons=4.fault-tolerance=1.sh
shell_wrappers += $(stress_wrappers)
EXTRA_DIST += $(stress_wrappers)

python_wrappers =
python_wrappers += test/sh/bindings.python.Admin.sh
Expand Down Expand Up @@ -883,7 +894,7 @@ python_wrappers += test/sh/bindings.python.MultiAttribute.sh
python_wrappers += test/sh/bindings.python.RangeSearchInt.sh
python_wrappers += test/sh/bindings.python.RangeSearchString.sh
python_wrappers += test/sh/bindings.python.RegexSearch.sh
shell_wrappers += $(python_wrappers)
EXTRA_DIST += $(python_wrappers)

java_wrappers =
java_wrappers += test/sh/bindings.java.BasicSearch.sh
Expand Down Expand Up @@ -915,7 +926,7 @@ java_wrappers += test/sh/bindings.java.MultiAttribute.sh
java_wrappers += test/sh/bindings.java.RangeSearchInt.sh
java_wrappers += test/sh/bindings.java.RangeSearchString.sh
java_wrappers += test/sh/bindings.java.RegexSearch.sh
shell_wrappers += $(java_wrappers)
EXTRA_DIST += $(java_wrappers)

ruby_wrappers =
ruby_wrappers += test/sh/bindings.ruby.BasicSearch.sh
Expand Down Expand Up @@ -944,7 +955,7 @@ ruby_wrappers += test/sh/bindings.ruby.MultiAttribute.sh
ruby_wrappers += test/sh/bindings.ruby.RangeSearchInt.sh
ruby_wrappers += test/sh/bindings.ruby.RangeSearchString.sh
ruby_wrappers += test/sh/bindings.ruby.RegexSearch.sh
shell_wrappers += $(ruby_wrappers)
EXTRA_DIST += $(ruby_wrappers)

go_wrappers =
go_wrappers += test/sh/bindings.go.Basic.sh
Expand Down Expand Up @@ -973,12 +984,12 @@ go_wrappers += test/sh/bindings.go.MultiAttribute.sh
go_wrappers += test/sh/bindings.go.RangeSearchInt.sh
go_wrappers += test/sh/bindings.go.RangeSearchString.sh
go_wrappers += test/sh/bindings.go.RegexSearch.sh
shell_wrappers += $(go_wrappers)
EXTRA_DIST += $(go_wrappers)

if ENABLE_ADMIN
if ENABLE_CLIENT
if ENABLE_PYTHON_BINDINGS
TESTS += $(doctest_wrappers)
TESTS += $(doctest_gremlins)

TESTS += $(python_wrappers)
check_PROGRAMS += bindings/python/hyperdex/admin.so
Expand All @@ -1000,18 +1011,6 @@ endif # ENABLE_PYTHON_BINDINGS
endif # ENABLE_CLIENT
endif # ENABLE_ADMIN

EXTRA_DIST += $(shell_wrappers)
EXTRA_DIST += test/doc.async-ops.py
EXTRA_DIST += test/doc.atomic-ops.py
EXTRA_DIST += test/doc.authorization.py
EXTRA_DIST += test/doc.data-types.py
EXTRA_DIST += test/doc.documents.py
EXTRA_DIST += test/doc-extract.py
EXTRA_DIST += test/doc.mongo.py
EXTRA_DIST += test/doc.quick-start.py
EXTRA_DIST += test/doctest-runner.py
EXTRA_DIST += test/env.sh
EXTRA_DIST += test/runner.py
EXTRA_DIST += test/python/Admin.py
EXTRA_DIST += test/python/Basic.py
EXTRA_DIST += test/python/BasicSearch.py
Expand Down
10 changes: 5 additions & 5 deletions maint/generate-doc-shell-stubs.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import os

template = '''#!/bin/sh
python2 "${{HYPERDEX_SRCDIR}}"/test/runner.py --daemons=1 -- \\
python2 "${{HYPERDEX_SRCDIR}}"/test/doctest-runner.py \\
"${{HYPERDEX_SRCDIR}}"/test/doc.{name}.py {{HOST}} {{PORT}}
template = '''#!/usr/bin/env gremlin
include 5-node-cluster
run python2 "${{HYPERDEX_SRCDIR}}"/test/doctest-runner.py "${{HYPERDEX_SRCDIR}}"/test/doc.{name}.py 127.0.0.1 1982
'''

for x in ('quick-start', 'data-types', 'async-ops', 'atomic-ops', 'documents', 'authorization'):
fname = 'test/sh/doc.{name}.sh'.format(name=x)
fname = 'test/gremlin/doc.{name}'.format(name=x)
f = open(fname, 'w')
f.write(template.format(name=x))
f.flush()
Expand Down
2 changes: 2 additions & 0 deletions test/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export HYPERDEX_SRCDIR="$1"
export HYPERDEX_BUILDDIR="$2"
export HYPERDEX_VERSION="$3"

export PATH=${HYPERDEX_BUILDDIR}:${HYPERDEX_SRCDIR}:${PATH}

export CLASSPATH="${HYPERDEX_BUILDDIR}"/bindings/java/org.hyperdex.client-${HYPERDEX_VERSION}.jar:"${HYPERDEX_BUILDDIR}"/test/java:${CLASSPATH}
export PYTHONPATH="$2"/bindings/python:"$2"/bindings/python/.libs:${PYTHONPATH}
export RUBYLIB="$1"/bindings/ruby/.libs:"$2"/bindings/ruby/.libs:${RUBYLIB}
33 changes: 33 additions & 0 deletions test/gremlin/5-node-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
env GLOG_logtostderr
env GLOG_minloglevel 0
env GLOG_logbufsecs 0

tcp-port 1982 1983 1984 1985 1986
tcp-port 2012 2013 2014 2015 2016

run mkdir coord0 coord1 coord2 coord3 coord4
run mkdir daemon0 daemon1 daemon2 daemon3 daemon4

daemon hyperdex coordinator --foreground --data=coord0 --listen 127.0.0.1 --listen-port 1982
run replicant server-status --host 127.0.0.1 --port 1982
daemon hyperdex coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1983 --connect-port 1982
run replicant server-status --host 127.0.0.1 --port 1983
daemon hyperdex coordinator --foreground --data=coord2 --listen 127.0.0.1 --listen-port 1984 --connect-port 1983
run replicant server-status --host 127.0.0.1 --port 1984
daemon hyperdex coordinator --foreground --data=coord3 --listen 127.0.0.1 --listen-port 1985 --connect-port 1984
run replicant server-status --host 127.0.0.1 --port 1985
daemon hyperdex coordinator --foreground --data=coord4 --listen 127.0.0.1 --listen-port 1986 --connect-port 1985
run replicant server-status --host 127.0.0.1 --port 1986

daemon hyperdex daemon --foreground --data=daemon0 --listen 127.0.0.1 --listen-port 2012 --coordinator 127.0.0.1 --coordinator-port 1982
#run replicant server-status --host 127.0.0.1 --port 1982
daemon hyperdex daemon --foreground --data=daemon1 --listen 127.0.0.1 --listen-port 2013 --coordinator 127.0.0.1 --coordinator-port 1983
#run replicant server-status --host 127.0.0.1 --port 1983
daemon hyperdex daemon --foreground --data=daemon2 --listen 127.0.0.1 --listen-port 2014 --coordinator 127.0.0.1 --coordinator-port 1984
#run replicant server-status --host 127.0.0.1 --port 1984
daemon hyperdex daemon --foreground --data=daemon3 --listen 127.0.0.1 --listen-port 2015 --coordinator 127.0.0.1 --coordinator-port 1985
#run replicant server-status --host 127.0.0.1 --port 1985
daemon hyperdex daemon --foreground --data=daemon4 --listen 127.0.0.1 --listen-port 2016 --coordinator 127.0.0.1 --coordinator-port 1986
#run replicant server-status --host 127.0.0.1 --port 1986

run sleep 5
4 changes: 4 additions & 0 deletions test/gremlin/doc.async-ops
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env gremlin
include 5-node-cluster

run python2 "${HYPERDEX_SRCDIR}"/test/doctest-runner.py "${HYPERDEX_SRCDIR}"/test/doc.async-ops.py 127.0.0.1 1982
4 changes: 4 additions & 0 deletions test/gremlin/doc.atomic-ops
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env gremlin
include 5-node-cluster

run python2 "${HYPERDEX_SRCDIR}"/test/doctest-runner.py "${HYPERDEX_SRCDIR}"/test/doc.atomic-ops.py 127.0.0.1 1982
4 changes: 4 additions & 0 deletions test/gremlin/doc.authorization
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env gremlin
include 5-node-cluster

run python2 "${HYPERDEX_SRCDIR}"/test/doctest-runner.py "${HYPERDEX_SRCDIR}"/test/doc.authorization.py 127.0.0.1 1982
4 changes: 4 additions & 0 deletions test/gremlin/doc.data-types
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env gremlin
include 5-node-cluster

run python2 "${HYPERDEX_SRCDIR}"/test/doctest-runner.py "${HYPERDEX_SRCDIR}"/test/doc.data-types.py 127.0.0.1 1982
4 changes: 4 additions & 0 deletions test/gremlin/doc.documents
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env gremlin
include 5-node-cluster

run python2 "${HYPERDEX_SRCDIR}"/test/doctest-runner.py "${HYPERDEX_SRCDIR}"/test/doc.documents.py 127.0.0.1 1982
4 changes: 4 additions & 0 deletions test/gremlin/doc.quick-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env gremlin
include 5-node-cluster

run python2 "${HYPERDEX_SRCDIR}"/test/doctest-runner.py "${HYPERDEX_SRCDIR}"/test/doc.quick-start.py 127.0.0.1 1982
4 changes: 0 additions & 4 deletions test/sh/doc.async-ops.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/sh/doc.atomic-ops.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/sh/doc.authorization.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/sh/doc.data-types.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/sh/doc.documents.sh

This file was deleted.

4 changes: 0 additions & 4 deletions test/sh/doc.quick-start.sh

This file was deleted.

0 comments on commit 870cbcd

Please sign in to comment.