Test::...o::MPD(3pm)

πŸ“¦
version 1.120990 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’… Test::Corpus::Audio::MPD πŸ’…

User Contributed Perl Documentation β€” yeah bestie, that's the manual this lil guy lives in, welcome to perl town πŸͺ✨


🌸 NAME 🌸

Test::Corpus::Audio::MPD β€” automate launching of fake mdp for testing purposes πŸŽ€


πŸ”₯ VERSION πŸ”₯

version 1.120990 β€” yes it's giving vintage, it's giving 2009, we love her πŸ’œ


✨ SYNOPSIS ✨

use Test::Corpus::Audio::MPD; # die if error
[...]
stop_test_mpd();

That's literally it. You use it, and at the end you stop_test_mpd(); and go about your day 🫢


πŸ’– DESCRIPTION πŸ’–

okay so here's the vibe: this module is gonna try to launch a whole new mpd server, purely for testing purposes. That test mpd server then gets used during your POE::Component::Client::MPD or Audio::MPD tests. She's the backup dancer, not the main character, but the show does not go on without her πŸ’ƒ

So how does she do it? First she creates a fake mpd.conf file with all the correct paths β€” like, the actual spot where you untarred the module tarball, no guessing. Then she checks whether some mpd server is already running, and if the MPD_TEST_OVERRIDE environment variable is true, she stops it (and if that variable isn't true? she dies. no cap, that's the rule 😭). Last step: she runs the test mpd with her shiny newly created configuration file. Slay.

And the best part? Everything I just described happens automatically the moment the module is use-d. You don't lift a finger, bestie πŸ’…

Once your tests are done running, the mpd server gets shut down, and the original one gets relaunched β€” but only if there actually was one to begin with. Respectful. Considerate. We stan 🌸

Note that the test mpd will listen to localhost, so you are on the safe side. Note also that the test suite comes with its own ogg files. Those files are 2 second tracks recording my voice saying ok, and are freely redistributable under the same license as the code itself. 🎧

And in case you want more control over the test mpd server β€” totally valid, sometimes you need to be the one driving β€” you can use the supplied public methods. This is highkey useful when you're trying to test connections with an mpd server πŸ”Œ


πŸ› οΈ METHODS πŸ› οΈ

πŸŽ€ customize_test_mpd_configuration( [$port] );

Create a fake mpd configuration file, based on the file mpd.conf.template located in the share subdir. The string PWD gets replaced by the real path (ie, where the tarball has been untarred), while TMP gets replaced by a brand new temp directory. And the string PORT? That one gets replaced by $port if you specified it, or 6600 otherwise β€” that's MPD's default, iykyk ✨

πŸ¦‹ my $dir = playlist_dir();

Return the temp dir where the test playlists will be stored. She's just a lil directory teller, doing her job, iconic 🫢

πŸ”₯ start_test_mpd();

Start the fake mpd, and die if there were any error. No error tolerance here, we keep it real πŸ’€

πŸ’œ stop_test_mpd();

Kill the fake mpd. That's it. That's the whole method. Clean, simple, periodt πŸ‘‘


🌈 SEE ALSO 🌈

You can look for information on this module at:

go read up bestie, the lore is out there πŸ“šπŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Jerome Quelin β€” thank you for your service, king πŸ«‘πŸ’


This software is copyright (c) 2009 by Jerome Quelin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. So like, go wild, but respectfully πŸ’–


and that's the whole page, bestie!! this doc was served up by perl v5.30.0 on 2019-11-03 and it belongs to Test::...o::MPD(3pm) β€” mwah, take care of her, she's fragile but she's everything πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from