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

mpd: add NixOS tests #42118

Merged
merged 1 commit into from Jul 4, 2018
Merged

mpd: add NixOS tests #42118

merged 1 commit into from Jul 4, 2018

Conversation

emmanuelrosa
Copy link
Contributor

@emmanuelrosa emmanuelrosa commented Jun 17, 2018

This change adds NixOS tests for the MPD (Music Player Daemon) module.
Tests include:

  • Playing audio locally using ALSA directly.
  • Playing audio locally using PulseAudio (backed by ALSA).
  • Playing audio from an external client.
  • Rejecting an external client when it's not explicitly allowed (default configuration).

These tests revealed a bug in the MDP module: Unlike the playlist directory, the music
directly is not created prior to starting MPD, causing MPD client commands to fail.
This change includes a fix for the aforementioned bug.

refs #41772

Motivation for this change

The intent of this change is to prepare the MDP module to be extended so it can optionally be configured to run as a systemd user service. These tests are meant to confirm the functionality of the MPD module as it stands today and mitigate the risk of making changes in the future.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • [ ] macOS
    • [ ] other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • [ ] Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.
Note

There's currently an issue with polkit. Because it doesn't build these tests will not run. However, they do run on nixos-unstable (4b649a9). In addition, something funky is going on with this markdown. I didn't intend this paragraph to be in-your-face like this. My troubleshooting muscles are done for today.

It builds now and the tests run.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

I can't run this test with nix-build nixos/tests/mpd.nix, this is the log: https://gist.github.com/Infinisil/7dc3bb2ca1054b002a165f19ad19f93b.
And I think the test should also be added to nixos/release.nix.

# License: http://creativecommons.org/licenses/by-sa/4.0/

name = "Blue_Wave_Theory-Skyhawk_Beach.mp3";
url = https://freemusicarchive.org/music/download/c7f57c4f783d3226610aaa41c5c2f0c7cbbb2958;
Copy link
Member

Choose a reason for hiding this comment

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

This isn't a persistent url, use https://freemusicarchive.org/file/music/ccCommunity/Blue_Wave_Theory/Surf_Music_Month_Challenge/Blue_Wave_Theory_-_04_-_Skyhawk_Beach.mp3 instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the polkit issue I mentioned (or something that's affecting polkit). I'll just rebase this unto the current nixos-unstable branch. It will run there.

Copy link
Member

Choose a reason for hiding this comment

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

Ohh right, sorry

@@ -166,6 +166,7 @@ in {
preStart = ''
mkdir -p "${cfg.dataDir}" && chown -R ${cfg.user}:${cfg.group} "${cfg.dataDir}"
mkdir -p "${cfg.playlistDirectory}" && chown -R ${cfg.user}:${cfg.group} "${cfg.playlistDirectory}"
mkdir -p "${cfg.musicDirectory}" && chown -R ${cfg.user}:${cfg.group} "${cfg.musicDirectory}"
Copy link
Member

@fpletz fpletz Jun 19, 2018

Choose a reason for hiding this comment

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

Not sure if this is really what we want because mpd doesn't touch files in the music directory in contrast to the data and playlist directories. For instance, in my case, the music directory is managed by other services which need to drop music in there.

Copy link
Member

Choose a reason for hiding this comment

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

This would also break my configuration. I have the music directory on a samba share and I don't want the owner to be changed to mpd (besides, chown would just fail with permission denied).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent. Keep the feedback coming :)

This change adds NixOS tests for the MPD (Music Player Daemon) module.
Tests include:

- Playing audio locally using ALSA directly.
- Playing audio locally using PulseAudio (backed by ALSA).
- Playing audio from an external client.
- Rejecting an external client when it's not explicitly allowed (default configuration).

refs NixOS#41772
@infinisil
Copy link
Member

@GrahamcOfBorg test mpd

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.mpd

Partial log (click to expand)

serverPulseAudio: running command: sync
serverPulseAudio: exit status 0
test script finished in 113.48s
cleaning up
killing client (pid 666)
killing serverALSA (pid 593)
killing serverPulseAudio (pid 617)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/awsppzj9a3n4k9nawqsql5nzihvlq596-vm-test-run-mpd

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: tests.mpd

Partial log (click to expand)

cannot build derivation '/nix/store/zyvmbby6cqhrmfg7vardjjzmap1y99vj-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/2k9aky7bq6f0v564yqzaa0pkss3gvfg0-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/c8ib7zx2ypmmj2m6kx4560w6345mg5nh-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/l1m2ay3jm7y5gkzpiz547m8lj6hk5xfd-run-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/0pxc80mwr9h6bdaq7n74wh156xmlpc79-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/jl957g1m7lkllkmqph8jadbl4k44gm4n-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/jvlgfi0h2lfn5dj5jrcr2z4q63qzjb36-nixos-vm.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/gxi9d1s95a05z3r37nac1g3zk8klppx4-nixos-test-driver-mpd.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/lnh3rhq9zjslq88pa6xcza6g095y2nh2-vm-test-run-mpd.drv': 1 dependencies couldn't be built
error: build of '/nix/store/lnh3rhq9zjslq88pa6xcza6g095y2nh2-vm-test-run-mpd.drv' failed

@infinisil infinisil merged commit fb29756 into NixOS:master Jul 4, 2018
@emmanuelrosa emmanuelrosa deleted the mpd-nixos-tests branch July 5, 2018 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants