From 8cd8125b071f4a0be8ec05d40471da6821067b07 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 22 Nov 2012 15:38:07 +0000 Subject: Parse the configuration file into arrays of jobs, via our test-factory --- t/test-protocol-ftp.rb | 91 ------------------------------------------- t/test-protocol-http.rb | 98 ----------------------------------------------- t/test-protocol-jabber.rb | 91 ------------------------------------------- t/test-protocol-ldap.rb | 91 ------------------------------------------- t/test-protocol-rsync.rb | 91 ------------------------------------------- t/test-protocol-smtp.rb | 91 ------------------------------------------- t/test-protocol-ssh.rb | 90 ------------------------------------------- t/test-protocol-tcp.rb | 94 --------------------------------------------- 8 files changed, 737 deletions(-) delete mode 100755 t/test-protocol-ftp.rb delete mode 100755 t/test-protocol-http.rb delete mode 100755 t/test-protocol-jabber.rb delete mode 100755 t/test-protocol-ldap.rb delete mode 100755 t/test-protocol-rsync.rb delete mode 100755 t/test-protocol-smtp.rb delete mode 100755 t/test-protocol-ssh.rb delete mode 100755 t/test-protocol-tcp.rb (limited to 't') diff --git a/t/test-protocol-ftp.rb b/t/test-protocol-ftp.rb deleted file mode 100755 index 4d237c4..0000000 --- a/t/test-protocol-ftp.rb +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -Ilib/ - - -require 'test/unit' -require 'custodian/protocol-tests/ftp.rb' - - - - -# -# Unit test for the FTP-protocol probe. -# -class TestFTPProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new FTPTest object. - # - def test_init - test_data_good = { - "target_host" => "mirror.bytemark.co.uk", - "test_type" => "ftp", - "verbose" => 1, - "test_port" => 21, - "test_alert" => "FTP service down", - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "mirror.bytemark.co.uk", - "test_type" => "ftp", - "verbose" => 1, - "test_alert" => "FTP service down", - } - - # - # Missing URL to probe - # - test_data_bad_two = { - "test_type" => "ftp", - "verbose" => 1, - "test_port" => 21, - "test_alert" => "FTP service down", - } - - - # - # Create a new FTPTest object. This should succeed - # - good = FTPTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = FTPTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing host. - # - assert_raise ArgumentError do - bad = FTPTest.new( test_data_bad_two ) - end - - end - - - -end diff --git a/t/test-protocol-http.rb b/t/test-protocol-http.rb deleted file mode 100755 index 422415c..0000000 --- a/t/test-protocol-http.rb +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -Ilib/ - - -require 'test/unit' -require 'custodian/protocol-tests/http.rb' - - - - - -# -# Unit test for the HTTP-protocol probe. -# -class TestHTTPProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new HTTPTest object. - # - def test_init - - test_data_good = { - "target_host" => "http://www.steve.org.uk/", - "test_type" => "http", - "verbose" => 1, - "test_port" => 80, - "test_alert" => "Steve's website is unavailable", - "http_text" => "Steve Kemp", - "http_status" => "200" - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "http://www.steve.org.uk/", - "test_type" => "http", - "verbose" => 1, - "test_alert" => "Steve's website is unavailable", - "http_text" => "Steve Kemp", - "http_status" => "200" - } - - # - # Missing URL to probe - # - test_data_bad_two = { - "test_type" => "http", - "test_port" => 80, - "verbose" => 1, - "test_alert" => "Steve's website is unavailable", - "http_text" => "Steve Kemp", - "http_status" => "200" - } - - - # - # Create a new HTTPTest object. This should succeed - # - good = HTTPTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = HTTPTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing URL. - # - assert_raise ArgumentError do - bad = HTTPTest.new( test_data_bad_two ) - end - end - - -end diff --git a/t/test-protocol-jabber.rb b/t/test-protocol-jabber.rb deleted file mode 100755 index 50db803..0000000 --- a/t/test-protocol-jabber.rb +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -Ilib/ - - -require 'test/unit' -require 'custodian/protocol-tests/jabber.rb' - - - - -# -# Unit test for the Jabber-protocol probe. -# -class TestJABBERProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new JABBERTest object. - # - def test_init - test_data_good = { - "target_host" => "chat.bytemark.co.uk", - "test_type" => "jabber", - "test_port" => 5222, - "verbose" => 1, - "test_alert" => "Chat server is down", - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "chat.bytemark.co.uk", - "test_type" => "jabber", - "verbose" => 1, - "test_alert" => "Chat server is down", - } - - # - # Missing a host to probe - # - test_data_bad_two = { - "test_type" => "jabber", - "test_port" => 5222, - "verbose" => 1, - "test_alert" => "Chat server is down", - } - - - # - # Create a new test object. This should succeed - # - good = JABBERTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = JABBERTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing host. - # - assert_raise ArgumentError do - bad = JABBERTest.new( test_data_bad_two ) - end - - end - - - -end diff --git a/t/test-protocol-ldap.rb b/t/test-protocol-ldap.rb deleted file mode 100755 index b7948ad..0000000 --- a/t/test-protocol-ldap.rb +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -Ilib/ - - -require 'test/unit' -require 'custodian/protocol-tests/ldap.rb' - - - - -# -# Unit test for the LDAP-protocol probe. -# -class TestLDAPProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new LDAPTest object. - # - def test_init - test_data_good = { - "target_host" => "auth.bytemark.co.uk", - "test_type" => "ldap", - "verbose" => 1, - "test_port" => 389, - "test_alert" => "LDAP server gone away?", - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "auth.bytemark.co.uk", - "test_type" => "ldap", - "verbose" => 1, - "test_alert" => "LDAP server gone away?", - } - - # - # Missing URL to probe - # - test_data_bad_two = { - "test_type" => "ldap", - "verbose" => 1, - "test_port" => 389, - "test_alert" => "LDAP server gone away?", - } - - - # - # Create a new test object. This should succeed - # - good = LDAPTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = LDAPTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing host. - # - assert_raise ArgumentError do - bad = LDAPTest.new( test_data_bad_two ) - end - - end - - - -end diff --git a/t/test-protocol-rsync.rb b/t/test-protocol-rsync.rb deleted file mode 100755 index 9bafd10..0000000 --- a/t/test-protocol-rsync.rb +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -Ilib/ - - -require 'test/unit' -require 'custodian/protocol-tests/rsync.rb' - - - - -# -# Unit test for the RSYNC-protocol probe. -# -class TestRSYNCProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new RSYNCTest object. - # - def test_init - test_data_good = { - "target_host" => "upload.ns.bytemark.co.uk", - "test_type" => "rsync", - "verbose" => 1, - "test_port" => 873, - "test_alert" => "DNS upload service is down", - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "upload.ns.bytemark.co.uk", - "test_type" => "rsync", - "verbose" => 1, - "test_alert" => "DNS upload service is down", - } - - # - # Missing host to probe - # - test_data_bad_two = { - "test_type" => "rsync", - "verbose" => 1, - "test_port" => 873, - "test_alert" => "DNS upload service is down", - } - - - # - # Create a new test object. This should succeed - # - good = RSYNCTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = RSYNCTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing host. - # - assert_raise ArgumentError do - bad = RSYNCTest.new( test_data_bad_two ) - end - - end - - - -end diff --git a/t/test-protocol-smtp.rb b/t/test-protocol-smtp.rb deleted file mode 100755 index b456d30..0000000 --- a/t/test-protocol-smtp.rb +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -Ilib/ - - -require 'test/unit' -require 'custodian/protocol-tests/smtp.rb' - - - - -# -# Unit test for the SMTP-protocol probe. -# -class TestSMTPProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new SMTPTest object. - # - def test_init - test_data_good = { - "target_host" => "statler.bytemark.co.uk", - "test_type" => "smtp", - "test_port" => 25, - "verbose" => 1, - "test_alert" => "SMTP service down", - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "statler.bytemark.co.uk", - "test_type" => "smtp", - "verbose" => 1, - "test_alert" => "SMTP service down", - } - - # - # Missing host to probe - # - test_data_bad_two = { - "test_type" => "smtp", - "verbose" => 1, - "test_port" => 25, - "test_alert" => "SMTP service down", - } - - - # - # Create a new SMTPTest object. This should succeed - # - good = SMTPTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = SMTPTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing host. - # - assert_raise ArgumentError do - bad = SMTPTest.new( test_data_bad_two ) - end - - end - - - -end diff --git a/t/test-protocol-ssh.rb b/t/test-protocol-ssh.rb deleted file mode 100755 index 9086eac..0000000 --- a/t/test-protocol-ssh.rb +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -I./lib/ - - -require 'test/unit' -require 'custodian/protocol-tests/ssh.rb' - - - -# -# Unit test for the SSH-protocol probe. -# -class TestSSHProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new SSHTest object. - # - def test_init - test_data_good = { - "target_host" => "127.0.0.1", - "test_type" => "ssh", - "verbose" => 1, - "test_port" => 22, - "test_alert" => "SSH service down", - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "127.0.0.1", - "test_type" => "ssh", - "verbose" => 1, - "test_alert" => "SSH service down", - } - - # - # Missing a host to probe - # - test_data_bad_two = { - "test_type" => "ssh", - "verbose" => 1, - "test_port" => 22, - "test_alert" => "SSH service down", - } - - - # - # Create a new test object. This should succeed - # - good = SSHTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = SSHTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing host. - # - assert_raise ArgumentError do - bad = SSHTest.new( test_data_bad_two ) - end - - end - - - -end diff --git a/t/test-protocol-tcp.rb b/t/test-protocol-tcp.rb deleted file mode 100755 index 655b6a1..0000000 --- a/t/test-protocol-tcp.rb +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/ruby -I../lib/ -Ilib/ - - -require 'test/unit' -require 'custodian/protocol-tests/tcp.rb' - - - - -# -# Unit test for the TCP-protocol probe. -# -class TestTCPProtocolProbe < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test we can create a new TCPTest object. - # - def test_init - test_data_good = { - "target_host" => "smtp.bytemark.co.uk", - "test_type" => "tcp", - "banner" => 220, - "verbose" => 1, - "test_port" => 25, - "test_alert" => "SMTP service down", - } - - # - # Missing a port number - # - test_data_bad_one = { - "target_host" => "smtp.bytemark.co.uk", - "test_type" => "tcp", - "banner" => 220, - "verbose" => 1, - "test_alert" => "SMTP service down", - } - - # - # Missing a target host to probe - # - test_data_bad_two = { - "test_type" => "tcp", - "banner" => 220, - "verbose" => 1, - "test_port" => 25, - "test_alert" => "SMTP service down", - } - - - # - # Create a new FTPTest object. This should succeed - # - good = TCPTest.new( test_data_good ) - assert( good ) - - # - # There will be no error setup - # - assert( good.error().nil? ) - - # - # Now create a probe with a missing port. - # - assert_raise ArgumentError do - bad = TCPTest.new( test_data_bad_one ) - end - - - # - # Now create a probe with a missing host. - # - assert_raise ArgumentError do - bad = TCPTest.new( test_data_bad_two ) - end - - end - - - -end -- cgit v1.2.1