mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
tstest/integration/vms: test on stable nixos (21.11)
I would like to do some more customized integration tests in the future, (specifically, bringing up a mitm proxy and testing tailscaled through that) so hoping to bring back the nixos wiring to support that. Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
parent
8226f1482c
commit
8f6d8cf979
@ -35,7 +35,7 @@ If you are using [Nix](https://nixos.org), you can run all of the tests with the
|
||||
correct command line tools using this command:
|
||||
|
||||
```console
|
||||
$ nix-shell -p openssh -p go -p qemu -p cdrkit --run "go test . --run-vm-tests --v --timeout 30m --no-s3"
|
||||
$ nix-shell -p nixos-generators -p openssh -p go -p qemu -p cdrkit --run "go test . --run-vm-tests --v --timeout 30m --no-s3"
|
||||
```
|
||||
|
||||
Keep the timeout high for the first run, especially if you are not downloading
|
||||
|
@ -20,6 +20,7 @@ type Distro struct {
|
||||
MemoryMegs int // VM memory in megabytes
|
||||
PackageManager string // yum/apt/dnf/zypper
|
||||
InitSystem string // systemd/openrc
|
||||
HostGenerated bool // generated image rather than downloaded
|
||||
}
|
||||
|
||||
func (d *Distro) InstallPre() string {
|
||||
|
@ -27,4 +27,13 @@
|
||||
"PackageManager": "apt",
|
||||
"InitSystem": "systemd"
|
||||
},
|
||||
{
|
||||
"Name": "nixos-21-11",
|
||||
"URL": "channel:nixos-21.11",
|
||||
"SHA256Sum": "lolfakesha",
|
||||
"MemoryMegs": 512,
|
||||
"PackageManager": "nix",
|
||||
"InitSystem": "systemd",
|
||||
"HostGenerated": true
|
||||
},
|
||||
]
|
||||
|
@ -18,3 +18,9 @@ func TestRunUbuntu2004(t *testing.T) {
|
||||
setupTests(t)
|
||||
testOneDistribution(t, 1, Distros[1])
|
||||
}
|
||||
|
||||
func TestRunNixos2111(t *testing.T) {
|
||||
t.Parallel()
|
||||
setupTests(t)
|
||||
testOneDistribution(t, 2, Distros[2])
|
||||
}
|
@ -49,6 +49,13 @@ func (vm *vmInstance) running() bool {
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Harness) makeImage(t *testing.T, d Distro, cdir string) string {
|
||||
if !strings.HasPrefix(d.Name, "nixos") {
|
||||
t.Fatal("image generation for non-nixos is not implemented")
|
||||
}
|
||||
return h.makeNixOSImage(t, d, cdir)
|
||||
}
|
||||
|
||||
// mkVM makes a KVM-accelerated virtual machine and prepares it for introduction
|
||||
// to the testcontrol server. The function it returns is for killing the virtual
|
||||
// machine when it is time for it to die.
|
||||
@ -67,7 +74,14 @@ func (h *Harness) mkVM(t *testing.T, n int, d Distro, sshKey, hostURL, tdir stri
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
mkLayeredQcow(t, tdir, d, fetchDistro(t, d))
|
||||
var qcowPath string
|
||||
if d.HostGenerated {
|
||||
qcowPath = h.makeImage(t, d, cdir)
|
||||
} else {
|
||||
qcowPath = fetchDistro(t, d)
|
||||
}
|
||||
|
||||
mkLayeredQcow(t, tdir, d, qcowPath)
|
||||
mkSeed(t, d, sshKey, hostURL, tdir, port)
|
||||
|
||||
driveArg := fmt.Sprintf("file=%s,if=virtio", filepath.Join(tdir, d.Name+".qcow2"))
|
||||
|
Loading…
Reference in New Issue
Block a user