root/honeyclient/branches/exp/jpuchalski-esx/t/honeyclient_manager.t

Revision 1582, 6.2 kB (checked in by kindlund, 8 months ago)

Added work_unit_limit logic; where cloned VMs will get recycled after visiting X number of URLs. This resolves the issue where our driving application may have a slow memory leak; where after X URLs the OS memory is completely filled, rendering the VM unusable. Instead, we preemptively destroy the VM and create a new one before we hit X. Initially, we'll let X = 2000 and go from there.

Line 
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Test::More 'no_plan';
5 $| = 1;
6
7
8
9 # =begin testing
10 {
11 # Make sure ExtUtils::MakeMaker loads.
12 BEGIN { use_ok('ExtUtils::MakeMaker', qw(prompt)) or diag("Can't load ExtUtils::MakeMaker package.  Check to make sure the package library is correctly listed within the path."); }
13 require_ok('ExtUtils::MakeMaker');
14 can_ok('ExtUtils::MakeMaker', 'prompt');
15 use ExtUtils::MakeMaker qw(prompt);
16
17 # Make sure Log::Log4perl loads
18 BEGIN { use_ok('Log::Log4perl', qw(:nowarn))
19         or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path.");
20        
21         # Suppress all logging messages, since we need clean output for unit testing.
22         Log::Log4perl->init({
23             "log4perl.rootLogger"                               => "DEBUG, Buffer",
24             "log4perl.appender.Buffer"                          => "Log::Log4perl::Appender::TestBuffer",
25             "log4perl.appender.Buffer.min_level"                => "fatal",
26             "log4perl.appender.Buffer.layout"                   => "Log::Log4perl::Layout::PatternLayout",
27             "log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n",
28         });
29 }
30 require_ok('Log::Log4perl');
31 use Log::Log4perl qw(:easy);
32
33 # Make sure HoneyClient::Util::Config loads.
34 BEGIN { use_ok('HoneyClient::Util::Config', qw(getVar))
35         or diag("Can't load HoneyClient::Util::Config package.  Check to make sure the package library is correctly listed within the path.");
36
37         # Suppress all logging messages, since we need clean output for unit testing.
38         Log::Log4perl->init({
39             "log4perl.rootLogger"                               => "DEBUG, Buffer",
40             "log4perl.appender.Buffer"                          => "Log::Log4perl::Appender::TestBuffer",
41             "log4perl.appender.Buffer.min_level"                => "fatal",
42             "log4perl.appender.Buffer.layout"                   => "Log::Log4perl::Layout::PatternLayout",
43             "log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n",
44         });
45 }
46 require_ok('HoneyClient::Util::Config');
47 can_ok('HoneyClient::Util::Config', 'getVar');
48 use HoneyClient::Util::Config qw(getVar);
49
50 # Suppress all logging messages, since we need clean output for unit testing.
51 Log::Log4perl->init({
52     "log4perl.rootLogger"                               => "DEBUG, Buffer",
53     "log4perl.appender.Buffer"                          => "Log::Log4perl::Appender::TestBuffer",
54     "log4perl.appender.Buffer.min_level"                => "fatal",
55     "log4perl.appender.Buffer.layout"                   => "Log::Log4perl::Layout::PatternLayout",
56     "log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n",
57 });
58
59 # Make sure the module loads properly, with the exportable
60 # functions shared.
61 BEGIN { use_ok('HoneyClient::Manager') or diag("Can't load HoneyClient::Manager package.  Check to make sure the package library is correctly listed within the path."); }
62 require_ok('HoneyClient::Manager');
63 use HoneyClient::Manager;
64
65 # Make sure HonyClient::Manager::VM::Clone loads.
66 BEGIN { use_ok('HoneyClient::Manager::VM::Clone') or diag("Can't load HoneyClient::Manager::VM::Clone package.  Check to make sure the package library is correctly listed within the path."); }
67 require_ok('HoneyClient::Manager::VM::Clone');
68 use HoneyClient::Manager::VM::Clone;
69
70 # Make sure HoneyClient::Util::SOAP loads.
71 BEGIN { use_ok('HoneyClient::Util::SOAP', qw(getServerHandle getClientHandle)) or diag("Can't load HoneyClient::Util::SOAP package.  Check to make sure the package library is correctly listed within the path."); }
72 require_ok('HoneyClient::Util::SOAP');
73 can_ok('HoneyClient::Util::SOAP', 'getServerHandle');
74 can_ok('HoneyClient::Util::SOAP', 'getClientHandle');
75 use HoneyClient::Util::SOAP qw(getServerHandle getClientHandle);
76
77 # Make sure HoneyClient::Util::Config loads.
78 BEGIN { use_ok('HoneyClient::Util::Config', qw(getVar)) or diag("Can't load HoneyClient::Util::Config package.  Check to make sure the package library is correctly listed within the path."); }
79 require_ok('HoneyClient::Util::Config');
80 can_ok('HoneyClient::Util::Config', 'getVar');
81 use HoneyClient::Util::Config qw(getVar);
82
83 # Make sure HoneyClient::Manager::Database loads.
84 BEGIN { use_ok('HoneyClient::Manager::Database') or diag("Can't load HoneyClient::Manager::Database package.  Check to make sure the package library is correctly listed within the path."); }
85 require_ok('HoneyClient::Manager::Database');
86 use HoneyClient::Manager::Database;
87
88 # Make sure Storable loads.
89 BEGIN { use_ok('Storable', qw(nfreeze thaw)) or diag("Can't load Storable package.  Check to make sure the package library is correctly listed within the path."); }
90 require_ok('Storable');
91 can_ok('Storable', 'nfreeze');
92 can_ok('Storable', 'thaw');
93 use Storable qw(nfreeze thaw);
94
95 # Make sure MIME::Base64 loads.
96 BEGIN { use_ok('MIME::Base64', qw(encode_base64 decode_base64)) or diag("Can't load MIME::Base64 package.  Check to make sure the package library is correctly listed within the path."); }
97 require_ok('MIME::Base64');
98 can_ok('MIME::Base64', 'encode_base64');
99 can_ok('MIME::Base64', 'decode_base64');
100 use MIME::Base64 qw(encode_base64 decode_base64);
101
102 # Make sure Data::Dumper loads
103 BEGIN { use_ok('Data::Dumper')
104         or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly listed within the path."); }
105 require_ok('Data::Dumper');
106 use Data::Dumper;
107
108 # Make sure Sys::Hostname loads.
109 BEGIN { use_ok('Sys::Hostname') or diag("Can't load Sys::Hostname package.  Check to make sure the package library is correctly listed within the path."); }
110 require_ok('Sys::Hostname');
111 use Sys::Hostname;
112
113 # Make sure Sys::HostIP loads.
114 BEGIN { use_ok('Sys::HostIP') or diag("Can't load Sys::HostIP package.  Check to make sure the package library is correctly listed within the path."); }
115 require_ok('Sys::HostIP');
116 use Sys::HostIP;
117 }
118
119
120
121 # =begin testing
122 {
123 SKIP: {
124     skip "HoneyClient::Manager->init() is not implemented, yet.", 1;
125 }
126 }
127
128
129
130 # =begin testing
131 {
132 SKIP: {
133     skip "HoneyClient::Manager->destroy() is not implemented, yet.", 1;
134 }
135 }
136
137
138
139 # =begin testing
140 {
141 SKIP: {
142     skip "HoneyClient::Manager->run() can't be easily tested, yet.", 1;
143 }
144 }
145
146
147
148
149 1;
Note: See TracBrowser for help on using the browser.