Skip to content

Commit

Permalink
nixos/manual: add hint to interactive testing about Internet access
Browse files Browse the repository at this point in the history
verified with following minimal test, embedded in a flake for ease of
execution:
```nix
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/master";
  outputs = { nixpkgs, ... }:
    let
      pkgs = import nixpkgs { system = "x86_64-linux"; };
    in
    {
      nixosTests.x86_64-linux.internet = pkgs.nixosTest {
        name = "internet";
        nodes.machine = { };
        # only succeeds in interactive mode
        testScript = ''
          machine.wait_for_unit("default.target")
          print(machine.succeed("curl -4 https://nixos.org"))
        '';
      };
    };
}
```

Launch this test interactively as described in the manual & run
`test_script()` to verify that the VM has Internet access.
  • Loading branch information
Zocker1999NET committed Aug 31, 2024
1 parent d5cbc4d commit 61fd315
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ $ ./result/bin/nixos-test-driver
>>>
```

::: {.note}
By executing the test driver in this way,
the VMs executed may gain network & Internet access via their backdoor control interface,
typically recognized as `eth0`.
:::

You can then take any Python statement, e.g.

```py
Expand Down

0 comments on commit 61fd315

Please sign in to comment.