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: Error in Frontend/Basic.t #353

Closed
bschmalhofer opened this issue Aug 13, 2020 · 3 comments
Closed

UnitTests: Error in Frontend/Basic.t #353

bschmalhofer opened this issue Aug 13, 2020 · 3 comments
Assignees
Labels
bug Something isn't working as intended
Milestone

Comments

@bschmalhofer
Copy link
Contributor

Looks like this is reproducible. Needs to be investigated.

scripts/test/Frontend/Basic.t                                                                  (Wstat: 0 Tests: 858 Failed: 8)
  Failed tests:  542, 545, 548, 619, 631, 799, 807, 833

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

bschmalhofer commented Aug 14, 2020

Confirmed, same errors under 10_1 as on August 14th.
No errors on 10_0.
Also made a small fix so that the test numbers are consistent when there is a failure.

bschmalhofer added a commit that referenced this issue Aug 14, 2020
Because I had problems comparing rel-10_0 and rel_10-1
bschmalhofer added a commit that referenced this issue Aug 14, 2020
Issue #353: make sure that test numbers won't be messed up
@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Aug 14, 2020

I have analysed this for the Frontend module AgentAppointmentEdit. For this module a fatal error should be thrown as quite understandably the ChallengeToken does not match. The HTTP response that should be generated in the case has:

  • Status 200 OK
  • Content-type HTML
  • Content-Length > 0

For analysing the issue I considered two cases:

  1. rel-10_0 running under Apache with apache2-httpd-psgi.include.conf
  2. rel-10_1 running under Apache with apache2-httpd-psgi.include.conf

In both cases otobo.psgi is handled by the PerlResponseHandler Plack::Handler::Apache2.

The initial impression was that 10.0 was working while 10.1 was broken. But this is only partially true, as the test script Frontend/Basic.t has limited knowledge what it should test.

For 10_0 we get a response:

HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: close
Date: Fri, 14 Aug 2020 12:49:18 GMT
Pragma: no-cache
Server: Apache/2.4.41 (Ubuntu)
Content-Length: 2
Content-Type: application/json; charset=utf-8
Expires: Tue, 1 Jan 1980 12:00:00 GMT
Client-Date: Fri, 14 Aug 2020 12:49:18 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
Content-Disposition: inline; 
X-Frame-Options: SAMEORIGIN
X-UA-Compatible: IE=edge,chrome=1

[]

This is an empty JSON array, which is acceptable for Frontend/Basic.t .

For t0_1 we get:

HTTP/1.1 200 OK
Connection: close
Date: Fri, 14 Aug 2020 12:42:51 GMT
Server: Apache/2.4.41 (Ubuntu)
Content-Length: 0
Client-Date: Fri, 14 Aug 2020 12:42:51 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1

This empty message is not acceptable for Frontend/Basic.t .

Both responses are incorrect as we really expect HTML with the error message Invalid Challenge Token!.

The root of the problem is that Kernel::Output::HTML::Layout::FatalError()calls exit() before the real response is delivered.This is a known problem as reported in #180. A solution exist in the 10_1 branch but this is currently only enabled for the InterfaceInstaller pages. See #323

TODO:

  • backport the exception handling fix from 10.1 to 10.0

  • in 10.0: throw the exception for FatalError() and CustomerFatalError() when OTOBO_RUNS_UNDER_PSGI is set

  • test with 10.0

  • merge the 10.0 changes into 10.1

  • in 10.1: throw the exception for FatalError() and CustomerFatalError() when OTOBO_RUNS_UNDER_PSGI is set

  • test with 10.1

@bschmalhofer bschmalhofer modified the milestones: OTOBO 10.1, OTOBO 10.0.3 Aug 15, 2020
bschmalhofer added a commit that referenced this issue Aug 15, 2020
Also add Plan() and Note() to Kernel::System::UnitTest::Driver
bschmalhofer added a commit that referenced this issue Aug 15, 2020
mostly tidying, grabbed from the rel-10_1 branch
Add the Exception object but don't use it yet
bschmalhofer added a commit that referenced this issue Aug 15, 2020
not only for CustomerFatalError()
bschmalhofer added a commit that referenced this issue Aug 15, 2020
Plack::Middleware::HTTPException does not catch string exceptions.
bschmalhofer added a commit that referenced this issue Aug 15, 2020
…/HTML/Layout.pm.new

Issue #353: remove inadvertently added file
bschmalhofer added a commit that referenced this issue Aug 15, 2020
The attribute StdoutIsCaptured is no longer needed.
bschmalhofer added a commit that referenced this issue Aug 15, 2020
Issue #353: always throw exception when OTOBO_RUNS_UNDER_PSGI
@bschmalhofer
Copy link
Contributor Author

Looks good. 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