Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
smradius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smradius
smradius
Commits
2b555351
Commit
2b555351
authored
Sep 22, 2016
by
Nigel Kukard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI: Improved checking of timestamps
parent
d38c5e7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
200-dbtests.t
t/200-dbtests.t
+36
-4
No files found.
t/200-dbtests.t
View file @
2b555351
...
...
@@ -4,6 +4,7 @@ use warnings;
use
AWITPT::
Util
;
use
Data::
Dumper
;
use
Date::
Parse
;
use
POSIX
qw(:sys_wait_h)
;
use
Test::
Most
;
use
Test::Most::
Exception
'throw_failure'
;
...
...
@@ -262,7 +263,7 @@ if ($child = fork()) {
'AcctDelayTime'
=>
'11'
,
'NASIdentifier'
=>
'Test-NAS1'
,
'AcctStatusType'
=>
1
,
'EventTimestamp'
=>
$session1_Timestamp_str
,
'EventTimestamp'
=>
sub
{
_timestampCheck
(
shift
,
$session1_Timestamp_str
)
}
,
'FramedIPAddress'
=>
'10.0.1.3'
,
'AcctSessionId'
=>
$session1_ID
,
'NASPortId'
=>
'test iface name1'
,
...
...
@@ -316,7 +317,7 @@ if ($child = fork()) {
'AcctDelayTime'
=>
'11'
,
'NASIdentifier'
=>
'Test-NAS1'
,
'AcctStatusType'
=>
3
,
'EventTimestamp'
=>
$session1_Timestamp_str
,
'EventTimestamp'
=>
sub
{
_timestampCheck
(
shift
,
$session1_Timestamp_str
)
}
,
'FramedIPAddress'
=>
'10.0.1.3'
,
'AcctSessionId'
=>
$session1_ID
,
'NASPortId'
=>
'test iface name1'
,
...
...
@@ -371,7 +372,7 @@ if ($child = fork()) {
'AcctDelayTime'
=>
'11'
,
'NASIdentifier'
=>
'Test-NAS1'
,
'AcctStatusType'
=>
2
,
'EventTimestamp'
=>
$session1_Timestamp_str
,
'EventTimestamp'
=>
sub
{
_timestampCheck
(
shift
,
$session1_Timestamp_str
)
}
,
'FramedIPAddress'
=>
'10.0.1.3'
,
'AcctSessionId'
=>
$session1_ID
,
'NASPortId'
=>
'test iface name1'
,
...
...
@@ -448,7 +449,7 @@ if ($child = fork()) {
'AcctInputGigawords'
=>
'0'
,
'AcctInputOctets'
=>
'102600046'
,
'AcctSessionTime'
=>
'800'
,
'EventTimestamp'
=>
$session2_Timestamp_str
,
'EventTimestamp'
=>
sub
{
_timestampCheck
(
shift
,
$session2_Timestamp_str
)
}
,
'FramedIPAddress'
=>
'10.0.1.1'
,
'AcctSessionId'
=>
$session2_ID
,
'NASPortId'
=>
'wlan1'
,
...
...
@@ -569,3 +570,34 @@ sub testDBResults
sub
_timestampCheck
{
my
(
$testVal
,
$rightVal
)
=
@_
;
# Make sure testVal is defined
return
"_timestampCheck: NO \$testVal"
if
(
!
defined
(
$testVal
));
# Make sure $testVal_time is returned form str2time
my
$testVal_time
=
str2time
(
$testVal
,
'UTC'
);
# Check if $rightVal is defined
my
$rightVal_time
;
if
(
!
defined
(
$rightVal
))
{
$rightVal_time
=
time
();
}
elsif
(
$rightVal
=~
/^\d+$/
)
{
$rightVal_time
=
$rightVal
;
}
else
{
$rightVal_time
=
str2time
(
$rightVal
,
'UTC'
);
}
# Make sure rightVal_time is defined
return
"_timestampCheck: NO \$rightVal_time"
if
(
!
defined
(
$rightVal_time
));
# Grab the absolute difference
my
$diff
=
abs
(
$testVal_time
-
$rightVal_time
);
return
(
$diff
<
10
)
//
"TIME DEVIATION: $diff"
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment