Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnitTests: two test Failures in Compile.t #486

Closed
bschmalhofer opened this issue Sep 28, 2020 · 2 comments
Closed

UnitTests: two test Failures in Compile.t #486

bschmalhofer opened this issue Sep 28, 2020 · 2 comments
Assignees
Labels
bug Something isn't working as intended
Milestone

Comments

@bschmalhofer
Copy link
Contributor

The cause is that Kernel::System::DateTime is loaded for use DateTime 1.08, which is not wanted.
The wrong module is loaded because Kernel/System is in @INC. The reason for that is not obvious. It is probably some unfortunate use lib $FindBin::Bin statement.

 DateTime defines neither package nor VERSION--version check failed at /opt/otobo/Kernel/System/DateTime.pm line 38.
# BEGIN failed--compilation aborted at /opt/otobo/Kernel/System/DateTime.pm line 38.
# Compilation failed in require at /opt/otobo/Kernel/System/DateTime.pm line 38.
# BEGIN failed--compilation aborted at /opt/otobo/Kernel/System/DateTime.pm line 38.
# Compilation failed in require at /opt/otobo/Kernel/Language.pm line 28.
# BEGIN failed--compilation aborted at /opt/otobo/Kernel/Language.pm line 28.
# Compilation failed in require at /opt/otobo/Kernel/Output/HTML/Layout.pm line 30.
# BEGIN failed--compilation aborted at /opt/otobo/Kernel/Output/HTML/Layout.pm line 30.
# Compilation failed in require at /opt/otobo/Kernel/System/ObjectManager.pm line 34.
# BEGIN failed--compilation aborted at /opt/otobo/Kernel/System/ObjectManager.pm line 34.
# Compilation failed in require at Kernel/System/UnitTest/RegisterDriver.pm line 42.
# BEGIN failed--compilation aborted at Kernel/System/UnitTest/RegisterDriver.pm line 42.

@bschmalhofer bschmalhofer added the bug Something isn't working as intended label Sep 28, 2020
@bschmalhofer bschmalhofer added this to the OTOBO 10.0.4 milestone Sep 28, 2020
@bschmalhofer bschmalhofer self-assigned this Sep 28, 2020
@bschmalhofer
Copy link
Contributor Author

Kernel::Config::Defaults is the culprit. This module sets @INC based on the location of the including script. A minimal example is:

otobo@5bc1685c346c:~$ cat Kernel/System/UnitTest/t.pl 
use FindBin qw($Bin);
use lib "$Bin/..";

use DateTime 1.08;
otobo@5bc1685c346c:~$ perl -c Kernel/System/UnitTest/t.pl 
DateTime defines neither package nor VERSION--version check failed at /opt/otobo/Kernel/System/UnitTest/../DateTime.pm line 38.
BEGIN failed--compilation aborted at /opt/otobo/Kernel/System/UnitTest/../DateTime.pm line 38.
Compilation failed in require at Kernel/System/UnitTest/t.pl line 4.
BEGIN failed--compilation aborted at Kernel/System/UnitTest/t.pl line 4.
otobo@5bc1685c346c:~$ 

Kernel::System is added to @INC, thusKernel::System::DateTimeis loaded, which has no version.

The fix is to remove the setup of @INC in Kernel/Config/Defaults.pm.

This was already fixed in #174, cc36ed8, but the patch was reverted because apparently other problems propped up. For OTOBO 10.1 this was fixed in #222.

bschmalhofer added a commit that referenced this issue Sep 29, 2020
bschmalhofer added a commit that referenced this issue Sep 29, 2020
@bschmalhofer
Copy link
Contributor Author

Tests look fine. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

1 participant