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

nixos/tests: only apply qemu parameters if the options are defined #101645

Merged
merged 1 commit into from Oct 25, 2020

Conversation

@andir
Copy link
Member

@andir andir commented Oct 25, 2020

Motivation for this change

This fixes an eval error that occurred on hydra with the small channel
and the nixos.tests.boot.biosCdrom.x86_64-linux attribute:

$ nix-instantiate nixos/release-small.nix -A nixos.tests.boot.biosCdrom.x86_64-linux
warning: unknown setting 'experimental-features'
error: The option `virtualisation.qemu' does not exist. Definition values:

  • In `/home/andi/dev/nixos/nixpkgs/nixos/modules/testing/test-instrumentation.nix':
    {
    consoles = [ ];
    package = {
    _type = "override";
    content = <derivation /nix/store/q72h2cdcb9zjgiay5gdgzwddjkbjr7xq-qemu-host-cpu-only-for-vm-tests-5.1.0.drv>;
    ...
    (use '--show-trace' to show detailed location information)

In bc2188b we changed test test-instrumentation to also set the QEMU
package that is being used. That change unfortunately caused us to
always assing values to the virtualisation.qemu.package option even when
the option is not defined. The original code was explicitly testing for
the consoles case but the then newly extended version did not adjust the
check as the intention was probably not clear.

With this commit we are always ensuring the entire virtualisation.qemu
section exists and can thus drop the individual tests for each of the
sections since the QEMU module always defines both the package and the
consoles option when it's root is defined..

Things done
  • Instantiated all the tests from the release-small.nix jobset as that is where the error did appear:
    • nix-instantiate nixos/release-small.nix -A "nixos.channel"
    • nix-instantiate nixos/release-small.nix -A "nixos.dummy.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.iso_minimal.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.manual.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.boot.biosCdrom.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.containers-imperative.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.containers-ip.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.firewall.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.installer.lvm.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.installer.separateBoot.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.installer.simple.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.ipv6.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.login.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.misc.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.nat.firewall-conntrack.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.nat.firewall.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.nat.standalone.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.nfs3.simple.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.openssh.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.php.fpm.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.php.pcre.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.predictable-interface-names.predictable.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.predictable-interface-names.predictableNetworkd.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.predictable-interface-names.unpredictable.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.predictable-interface-names.unpredictableNetworkd.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.proxy.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixos.tests.simple.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixpkgs.jdk.x86_64-linux"
    • nix-instantiate nixos/release-small.nix -A "nixpkgs.tarball"

This is the outcome of a discussion over at #101598 (comment)

cc @xaverdh

This fixes an eval error that occurred on hydra with the small channel
and the `nixos.tests.boot.biosCdrom.x86_64-linux` attribute:

> $ nix-instantiate nixos/release-small.nix -A nixos.tests.boot.biosCdrom.x86_64-linux
> warning: unknown setting 'experimental-features'
> error: The option `virtualisation.qemu' does not exist. Definition values:
> - In `/home/andi/dev/nixos/nixpkgs/nixos/modules/testing/test-instrumentation.nix':
>     {
>       consoles = [ ];
>       package = {
> 	_type = "override";
> 	content = <derivation /nix/store/q72h2cdcb9zjgiay5gdgzwddjkbjr7xq-qemu-host-cpu-only-for-vm-tests-5.1.0.drv>;
>     ...
> (use '--show-trace' to show detailed location information)

In bc2188b we changed test test-instrumentation to also set the QEMU
package that is being used. That change unfortunately caused us to
always assing values to the virtualisation.qemu.package option even when
the option is not defined. The original code was explicitly testing for
the consoles case but the then newly extended version did not adjust the
check as the intention was probably not clear.

With this commit we are always ensuring the entire virtualisation.qemu
section exists and can thus drop the individual tests for each of the
sections since the QEMU module always defines both the package and the
consoles option when it's root is defined..
Ma27
Ma27 approved these changes Oct 25, 2020
@Ma27 Ma27 merged commit a3041ab into NixOS:master Oct 25, 2020
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants