From 68328b6e15a38a74261ee46b06091b8e63f85499 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 9 Dec 2013 23:06:19 -0800 Subject: added initial white-box tests for couchdb and webapp nodes --- tests/white-box/dummy.rb | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/white-box/dummy.rb (limited to 'tests/white-box/dummy.rb') diff --git a/tests/white-box/dummy.rb b/tests/white-box/dummy.rb new file mode 100644 index 00000000..dd343769 --- /dev/null +++ b/tests/white-box/dummy.rb @@ -0,0 +1,44 @@ +# only run in the dummy case where there is no hiera.yaml file. +raise SkipTest unless $node["dummy"] + +class Robot + def can_shoot_lasers? + "OHAI!" + end + + def can_fly? + "YES!" + end +end + +class TestDummy < LeapTest + def setup + @robot = Robot.new + end + + def test_lasers + assert_equal "OHAI!", @robot.can_shoot_lasers? + pass + end + + def test_fly + refute_match /^no/i, @robot.can_fly? + pass + end + + def test_blah + fail "blah" #assert false + pass + end + + def test_01_will_be_skipped + skip "test this later" + pass + end + + def test_err + 12/0 + pass + end + +end -- cgit v1.2.3 From 34678e895a5a40da6f444199983fee3f8ce518ee Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 27 Dec 2013 02:43:24 -0800 Subject: added some network tests for stunnel --- tests/white-box/dummy.rb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tests/white-box/dummy.rb') diff --git a/tests/white-box/dummy.rb b/tests/white-box/dummy.rb index dd343769..6ca49754 100644 --- a/tests/white-box/dummy.rb +++ b/tests/white-box/dummy.rb @@ -26,8 +26,8 @@ class TestDummy < LeapTest pass end - def test_blah - fail "blah" #assert false + def test_fail + fail "fail" pass end @@ -36,8 +36,24 @@ class TestDummy < LeapTest pass end - def test_err - 12/0 + def test_socket_failure + assert_tcp_socket('localhost', 900000) + pass + end + + def test_socket_success + fork { + Socket.tcp_server_loop('localhost', 12345) do |sock, client_addrinfo| + begin + sock.write('hi') + ensure + sock.close + exit + end + end + } + sleep 0.2 + assert_tcp_socket('localhost', 12345) pass end -- cgit v1.2.3 From 0a56b656f8fbfd38ee1a9babdb93fbed39c4a973 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 27 Dec 2013 12:27:53 -0800 Subject: improve couchdb test --- tests/white-box/dummy.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/white-box/dummy.rb') diff --git a/tests/white-box/dummy.rb b/tests/white-box/dummy.rb index 6ca49754..a3e8ad68 100644 --- a/tests/white-box/dummy.rb +++ b/tests/white-box/dummy.rb @@ -41,6 +41,17 @@ class TestDummy < LeapTest pass end + def test_warn + block_test do + warn "not everything", "is a success or failure" + end + end + + # used to test extracting the proper caller even when in a block + def block_test + yield + end + def test_socket_success fork { Socket.tcp_server_loop('localhost', 12345) do |sock, client_addrinfo| -- cgit v1.2.3