os-autoinst / openQA

openQA web-frontend, scheduler and tools.
http://openqa.opensuse.org/
GNU General Public License v2.0
314 stars 206 forks source link

Add test for render_specific_not_found #5770

Closed perlpunk closed 1 month ago

perlpunk commented 1 month ago

Issue: https://progress.opensuse.org/issues/163931

It now returns a plain text, because we don't have all helpers and variables for a fully fledged openQA page in the livehandler. That's probably ok for such pages that you normally don't link to directly.

perlpunk commented 1 month ago

I thought that maybe it couldn't find the template, so I added

$self->renderer->paths->[0] = path($self->renderer->paths->[0])->child('webapi')->to_string;

to the live handler app, but no success.

So currently I'm wondering if this actually works in production, if the LiveHandler doesn't have the path to the templates.

Martchus commented 1 month ago

I guess it doesn't work in production: https://openqa.opensuse.org/liveviewhandler/tests/4345159/streaming

I also tested this locally: http://localhost:9528/liveviewhandler/tests/1234/streaming Locally I'm getting the same error you mentioned in the PR description.

perlpunk commented 1 month ago

Like discussed I made the specific template a plaintext page. I guess it still has to be mocked. It would be nice if the error message from Mojolicious would tell us more details, though. In the log I see [trace] [mIY3-s_V52Eq] Template "main/specific_not_found.html.ep" not found. Why is that a trace message only?

perlpunk commented 1 month ago

Before I can continue to think about what to do I first need to know how I get to a /tests/id/edit page in the webui. t/ui/12-needle-edit.t is failing, and I don't see the actual problem when running in non headless mode. I don't see any "edit test" link. So is this page supposed to be seen by a human or not?

Martchus commented 1 month ago

When I remember correctly, this route can be accessed via the developer mode when the test is paused on a needle mismatch.

perlpunk commented 1 month ago

The function now returns a plain text (although that's probably not strictly what you are supposed to return for text/html. I should probably do $c->res->headers->content_type('text/plain'); as well?

edit: did that now

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.49%. Comparing base (1979f49) to head (3c1672b).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5770 +/- ## ======================================= Coverage 98.49% 98.49% ======================================= Files 394 394 Lines 38657 38669 +12 ======================================= + Hits 38074 38086 +12 Misses 583 583 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.