Skip to content

Fix failures of D-Bus' Register tests#3156

Merged
ptoscano merged 4 commits intomainfrom
mhorky/pytest-dbus-register-fix
Nov 30, 2022
Merged

Fix failures of D-Bus' Register tests#3156
ptoscano merged 4 commits intomainfrom
mhorky/pytest-dbus-register-fix

Conversation

@m-horky
Copy link
Contributor

@m-horky m-horky commented Oct 31, 2022

Our test that checks if it is possible to connect to newly created socket started failing with 'Permission denied' when the code tried to use it. Pytest cannot write into '/run', moving it to '/tmp' solves the issue.

@cnsnyder cnsnyder requested review from a team and wottop and removed request for a team October 31, 2022 17:11
Copy link
Contributor

@ptoscano ptoscano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea... however it still fails :-D

Few things:

  • wouldn't it be better to patch directly in DBusServerStubProvider, so it applies automatically to all the D-Bus tests?
  • maybe I would create a single temporary directory within /tmp where to store all the D-Bus server sockets for all the D-Bus tests; this way /tmp is not polluted with sockets on failure
  • I would only configure the directory in DomainSocketServer, rather the whole address string; this makes it less fragile to change/patch

@m-horky
Copy link
Contributor Author

m-horky commented Nov 2, 2022

1/ I don't think it makes sense to move the patch to DBusServerStubProvider; the DomainSocketServer is only started in the Register object. We are most certainly not extending it to other objects.
2/ Done.
3/ I've split it into two class variables.

The PR worked for me before and works now, after the changes; I can't reproduce the CI failure. We'll see if it gets better.

@m-horky m-horky force-pushed the mhorky/pytest-dbus-register-fix branch from 384660e to d45009e Compare November 2, 2022 09:47
This could help us with debugging errors when a test crashes on CI, but
not locally.
@m-horky m-horky force-pushed the mhorky/pytest-dbus-register-fix branch 4 times, most recently from 947a900 to e5a8656 Compare November 7, 2022 15:52
@m-horky m-horky force-pushed the mhorky/pytest-dbus-register-fix branch from e5a8656 to b3e6074 Compare November 28, 2022 11:48
The markers were removed before, but the D-Bus tests tend to fail
*sometimes*, so it is useful to keep this in. All D-Bus tests inherit
from this class, so we only have to do it here in one place.
@m-horky m-horky force-pushed the mhorky/pytest-dbus-register-fix branch from b3e6074 to 557ca9f Compare November 28, 2022 13:14
@m-horky m-horky force-pushed the mhorky/pytest-dbus-register-fix branch 2 times, most recently from f1dfad0 to b283fce Compare November 28, 2022 17:14
@ptoscano
Copy link
Contributor

Sounds good now, thanks! (and we hopefully know what's the cause now)

One small thing: since we know what was the reason for the change, can you please amend the message of the commit "Fix failures of D-Bus' Register tests" to mention that? right now it still says "unknown reasons"

Our test that checks if it is possible to connect to newly created
socket started failing with 'Permission denied' when the code tried to
use it. Pytest cannot write into '/run', moving it to '/tmp' solves the
issue.

Additionally, as a result of relatively recent D-Bus implementation
changes, 'tmpdir' and 'dir' behave the same and create regular socket,
not an abstract socket. Connecting with "\0" prefix (which signifies the
abstract one) now fails and thus has been removed from the tests.
@m-horky m-horky force-pushed the mhorky/pytest-dbus-register-fix branch from b283fce to bae7ce3 Compare November 30, 2022 13:41
Copy link
Contributor

@ptoscano ptoscano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ptoscano ptoscano merged commit c4321a3 into main Nov 30, 2022
@ptoscano ptoscano deleted the mhorky/pytest-dbus-register-fix branch November 30, 2022 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants