Re: How to test modified shepherd services

2021-12-26 Thread Maxim Cournoyer
Hello,

Simon South  writes:

> Nathan Dehnel  writes:
>> I modified a shepherd service to accept a new field from config.scm
>> and I was wondering how to test that it works correctly.
>
> Assuming this is an existing Guix service, it's probably easiest to
> update the corresponding system test suite under gnu/tests (if
> necessary) to reflect your change, then run the suite with "make
> check-system" (setting "TESTS" to limit it to the service in question)
> to make sure everything works the way you expect.
>
> If you're planning on contributing the change to Guix it would be good
> to submit it along with an updated test suite anyway.
>
> The Guix manual has a bit of information about this in Section 2.3,
> "Running the Test Suite":
>
> https://guix.gnu.org/en/manual/en/html_node/Running-the-Test-Suite.html#Running-the-Test-Suite

+1.  System tests are the best way to validate system services.  You'll
save time by writing/extending one.

Maxim



Re: How to test modified shepherd services

2021-12-20 Thread Nathan Dehnel
Thanks, that worked.

On Mon, Dec 20, 2021 at 4:00 AM Attila Lendvai  wrote:
>
> i have just finished my first Guix service. for now it's a PR for that other 
> channel, so i'll copy-paste some stuff from it:
>
> Run with something like this:
>
> $(guix system --no-graphic vm path/to/swarm.scm) -m 2048
>
> $(./pre-inst-env guix system --no-graphic vm /path/to/swarm.scm) -m 2048
>
> this will build and boot an operating-system object in a Qemu VM, in the same 
> terminal.
>
> the file should return a simple-operating-system object, optionally wrapped 
> into a marionette-operating-system if you also want to write/run automated 
> tests.
>
> i'll send you the link to the actual code in a private email.
>
> - attila
> PGP: 5D5F 45C7 DFCD 0A39
>



Re: How to test modified shepherd services

2021-12-20 Thread Attila Lendvai
i have just finished my first Guix service. for now it's a PR for that other 
channel, so i'll copy-paste some stuff from it:

Run with something like this:

$(guix system --no-graphic vm path/to/swarm.scm) -m 2048

$(./pre-inst-env guix system --no-graphic vm /path/to/swarm.scm) -m 2048

this will build and boot an operating-system object in a Qemu VM, in the same 
terminal.

the file should return a simple-operating-system object, optionally wrapped 
into a marionette-operating-system if you also want to write/run automated 
tests.

i'll send you the link to the actual code in a private email.

- attila
PGP: 5D5F 45C7 DFCD 0A39




Re: How to test modified shepherd services

2021-12-20 Thread Simon South
Nathan Dehnel  writes:
> I modified a shepherd service to accept a new field from config.scm
> and I was wondering how to test that it works correctly.

Assuming this is an existing Guix service, it's probably easiest to
update the corresponding system test suite under gnu/tests (if
necessary) to reflect your change, then run the suite with "make
check-system" (setting "TESTS" to limit it to the service in question)
to make sure everything works the way you expect.

If you're planning on contributing the change to Guix it would be good
to submit it along with an updated test suite anyway.

The Guix manual has a bit of information about this in Section 2.3,
"Running the Test Suite":

https://guix.gnu.org/en/manual/en/html_node/Running-the-Test-Suite.html#Running-the-Test-Suite

-- 
Simon South
si...@simonsouth.net



Re: How to test modified shepherd services

2021-12-19 Thread raingloom
On Sun, 19 Dec 2021 16:47:07 -0600
Nathan Dehnel  wrote:

> I modified a shepherd service to accept a new field from config.scm
> and I was wondering how to test that it works correctly. Do I need to
> make a VM from my modified guix repo with pre-inst-env?
> 

That's probably the best way, it's how I was testing the yggdrasil
service. Definitely do not reconfigure without first testing it in a VM
or container or something.

Word of warning: shepherd is not very forthcoming with logs. You might
want to add some extra logging and redirect output to a file.