[Freedombox-discuss] issue https://salsa.debian.org/freedombox-team/freedombox/-/issues/1998

Fioddor Superconcentrado fioddor at gmail.com
Tue Jun 8 18:07:06 BST 2021


You should have a look inside *plinth/modules/storage/tests/* directory.

*storage.feature* is the behaviour description of the tests. It is written
in an easy human-readable formal language called Gherkin. Currently it
contains only one scenario (Scenario: List disks).

'Background' marks the part that is common to all scenarios. But as I said,
we currently have only one in this file.
The line 'Given I'm a logged in user' logs' the user in.

The line 'Given I'm on the storage page' calls the function in file
*test_functional.py* marked with '@given(parsers.parse("I'm on the {name:w}
page"))'.
The line'Then the root disk should be shown'calls the function in file
*test_functional.py* marked with '@then('the root disk should be shown')'.

This way, the functional behaviour (independent from the implementation) is
defined in **.features* files. And then other **.py* files resolve the
underlying implementation.

Now we need to fix the test by making it check first if it is running
inside a container (with systemd-detect-virt --container) and if that's the
case, it should report 'skipped' as test result and abort/skip the rest of
the test.

We should apply the rule at scenario level, because If we in the future add
another scenario, only the current one should be skipped (and only if run
within a container).

The check to make sure we're not running inside a container should be
reusable for other scenarios even beyond storage tests. So if we consider
it functional, it would belong in the common library for functional steps:
*plinth/tests/functional/step_definitions.py*, where the function which
logs the user resides. But "being run on a container" sounds technical
rather than functional, so it most likely belongs somewhere else under
*plinth/tests*. Perhaps *__init__.py*? Or *config.py*?






El mar, 8 jun 2021 a las 15:57, Tiago Zaniquelli via Freedombox-discuss (<
freedombox-discuss at alioth-lists.debian.net>) escribió:

> Ok...
>
> I did the two suggestion...
>
> First(first.png)... it showed me skipped (test_list_disks)...
>
> Second(second_one.png, second_two.png)...it showed me a  error because
> some html... Is this error that need to correct?
>
> Regards,
>
> Tiago Zaniquelli
>
>
> Sent with ProtonMail Secure Email.
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> Em segunda-feira, junho 7, 2021 7:39 PM, James Valleroy via
> Freedombox-discuss <freedombox-discuss at alioth-lists.debian.net> escreveu:
>
> > On 6/7/21 4:35 PM, Tiago Zaniquelli via Freedombox-discuss wrote:
> >
> > > Ahhh, ok.
> > > I tried to simulate, but for me everything is ok, and I'm inside the
> container
> > > Could you help me simulate?
> >
> > Note that the functional tests are skipped by default.
> > To include them, add the "--include-functional" option:
> >
> > $ py.test-3 --include-functional plinth/modules/storage/tests/
> >
> >
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> > James
> >
> > Freedombox-discuss mailing list
> > Freedombox-discuss at alioth-lists.debian.net
> >
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/freedombox-discuss
>
> _______________________________________________
> Freedombox-discuss mailing list
> Freedombox-discuss at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/freedombox-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/freedombox-discuss/attachments/20210608/13a24bc0/attachment.htm>


More information about the Freedombox-discuss mailing list