Skip to content

Use nix daemon in the test suite#9632

Merged
edolstra merged 2 commits intoNixOS:masterfrom
cole-h:nix-daemon-testing
Jan 19, 2024
Merged

Use nix daemon in the test suite#9632
edolstra merged 2 commits intoNixOS:masterfrom
cole-h:nix-daemon-testing

Conversation

@cole-h
Copy link
Member

@cole-h cole-h commented Dec 18, 2023

Motivation

As part of the CLI stabilization effort (#7701), the last remaining checkbox (at the moment) for nix daemon is that it "needs testing". This implements the proposal of using nix daemon in place of nix-daemon in the test suite.

Context

The box for nix daemon is unchecked, and this is supposedly the only thing blocking it, so I figured I'd propose the most minimal diff to address it.

I grepped for nix-daemon in the tests/ subdirectory -- hopefully I didn't miss anything.

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@cole-h cole-h requested a review from edolstra as a code owner December 18, 2023 19:29
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Dec 18, 2023
As part of the CLI stabilization effort, the last remaining checkbox (at
the moment) for `nix daemon` is that it "needs testing". This implements
the proposal of using `nix daemon` in place of `nix-daemon` in the test
suite.
@cole-h cole-h force-pushed the nix-daemon-testing branch from b471a69 to 1f7b62f Compare December 18, 2023 19:30
@thufschmitt
Copy link
Member

Thanks!

I don't think we can just replace nix-daemon by nix daemon everywhere, because we still want to test the old nix-daemon. That being said, I'm not sure why we need two different – but semantically equivalent – entry points for both: this one for nix-daemon and that one for nix daemon.

@edolstra, is there a reason why these are separate, or can we have nix-daemon piggyback on CmdDaemon?

@thufschmitt thufschmitt linked an issue Dec 20, 2023 that may be closed by this pull request
@edolstra
Copy link
Member

I think they're separate because originally we didn't have a single binary, so nix-daemon really was a separate executable. But I guess we can unify them now.

@thufschmitt
Copy link
Member

But I guess we can unify them now.

Yay!

How do we do that? (technically I mean)

@Ericson2314
Copy link
Member

I don't get what is so surprising? I don't think we've ever tried to make a legacy command new-style before. Maybe it's fine in this case, but it does mean we have to be careful about modifying nix daemon if it will modify nix-daemon too.

@thufschmitt
Copy link
Member

@Ericson2314 : Nothing surprising, just a potential for simplification

@edolstra
Copy link
Member

@cole-h Maybe we can arbitrarily keep some of the calls to nix-daemon, so that both get tested.

This means that both `nix daemon` and `nix-daemon` will be (somewhat)
tested.
@cole-h
Copy link
Member Author

cole-h commented Jan 13, 2024

I opted to keep nix daemon as the "overall" daemon for the tests and changed back a couple call sites to use nix-daemon again.

I wonder if it would be better to have another set of hydraJobs -- one for nix-daemon and one for nix daemon as the "overall" test daemon. This would essentially mean running the tests twice, of course, so I wonder if that might OK in the "near" term.

@roberth
Copy link
Member

roberth commented Jan 15, 2024

This would essentially mean running the tests twice

As you hinted, this strategy is quite expensive.
We could easily run a single tests/functional-style test twice, but we don't have one. All we have is tests that involve the daemon by coincidence, and a NixOS test about authorization, where it's not possible to pick a daemon command.

The right solution is to write a proper tests for the daemon command(s). If we don't merge their implementations, we can have two tiny tests that source the same test script.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2021-01-11-nix-team-meeting-minutes-115/38277/1

@edolstra edolstra merged commit e6e160a into NixOS:master Jan 19, 2024
@cole-h cole-h deleted the nix-daemon-testing branch January 19, 2024 15:22
tebowy pushed a commit to tebowy/nix that referenced this pull request Jul 11, 2024
Use `nix daemon` in the test suite

(cherry picked from commit e6e160a)
Change-Id: I537a25d3d48f609cd77b2c3a8ad68e87aebabfe8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

with-tests Issues related to testing. PRs with tests have some priority

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Test the nix daemon command

6 participants