Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
0fce77f8
Commit
0fce77f8
authored
12 years ago
by
Jakub Cegan
Browse files
Options
Downloads
Patches
Plain Diff
(task 613) Upravy skriptu a pridani testu
parent
d4569374
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/warden-server/bin/wardenWatchdog.t
+71
-0
71 additions, 0 deletions
src/warden-server/bin/wardenWatchdog.t
with
71 additions
and
0 deletions
src/warden-server/bin/wardenWatchdog.t
0 → 100644
+
71
−
0
View file @
0fce77f8
#!/usr/bin/perl
use
strict
;
use
warnings
;
use
DBI
;
use
DBD::
mysql
;
use
Data::
Dumper
;
use
Test::
More
tests
=>
7
;
use
Test::
MockModule
;
use
Test::
Exception
;
use
lib
'
..
';
use
wardenWatchdog
;
my
(
%input
,
$retCode
,
$result
);
print
"
== wardenWatchdog::send_report ==
\n
";
*
wardenWatchdog::
sendmail_wrapper
=
sub
{
print
"
sendmailWrapper is set to broken!
\n
Sending of emails will fail
\n
";
return
0
;};
%input
=
(
contact
=>
'
test@test.receiver.cz
',
domain
=>
'
test.domain.cz
',
text
=>
'
TEST MSG!
');
(
$retCode
,
$result
)
=
wardenWatchdog::
send_report
(
\
%input
);
ok
(
$retCode
==
0
,
'
Broken sendmail
');
*
wardenWatchdog::
sendmail_wrapper
=
sub
{
print
"
sendmailWrapper is OFF!
\n
Sending of emails is blocked
\n
";
return
1
;};
%input
=
(
contact
=>
'',
domain
=>
'
test.domain.cz
',
text
=>
'
TEST MSG!
');
(
$retCode
,
$result
)
=
wardenWatchdog::
send_report
(
\
%input
);
ok
(
$retCode
==
0
,
'
No contact
');
%input
=
(
contact
=>
'
test@test.receiver.cz
',
domain
=>
'',
text
=>
'
TEST MSG!
');
(
$retCode
,
$result
)
=
wardenWatchdog::
send_report
(
\
%input
);
ok
(
$retCode
==
0
,
'
No domain
');
%input
=
(
contact
=>
'',
domain
=>
'
test.domain.cz
',
text
=>
'');
(
$retCode
,
$result
)
=
wardenWatchdog::
send_report
(
\
%input
);
ok
(
$retCode
==
0
,
'
No text
');
%input
=
(
contact
=>
'
test@test.receiver.cz
',
domain
=>
'
test.domain.cz
',
text
=>
'
TEST MSG!
');
(
$retCode
,
$result
)
=
wardenWatchdog::
send_report
(
\
%input
);
ok
(
$retCode
==
1
,
'
All OK
');
print
"
== wardenWatchdog::connect_to_DB ==
\n
";
my
$dbh
;
(
$retCode
,
$result
)
=
connect_to_DB
(
\
$dbh
);
ok
(
$retCode
==
1
,
'
Connected to the DB
');
# FAILED DB CONNECTION
print
"
== wardenWatchdog::update_procedures ==
\n
";
# CORRECT RUN OF update_procedures
print
"
== wardenWatchdog::send_query ==
\n
";
# RUN WITH BROKEN DB CONNECTION
# RUN WITH NO query
# CORRECT RUN OF send_query
print
"
== wardenWatchdog::run ==
\n
";
# RUN WITHOUT domain
# RUN WITHOUT period
# CORRECT RUN OF send_query
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment