tstest/integration/vms,.github/workflows: bump Ubuntu and NixOS for VM tests + cleanup (#16098)
This PR cleans up a bunch of things in ./tstest/integration/vms: - Bumps version of Ubuntu that's actually run from CI 20.04 -> 24.04 - Removes Ubuntu 18.04 test - Bumps NixOS 21.05 -> 25.05 Updates#cleanup Signed-off-by: Irbe Krumina <irbe@tailscale.com>main
parent
d01a0adfa6
commit
7df7e01d0f
@ -1,85 +0,0 @@ |
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build !windows && !plan9
|
||||
|
||||
package vms |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"os" |
||||
"path/filepath" |
||||
"testing" |
||||
|
||||
"github.com/google/uuid" |
||||
) |
||||
|
||||
/* |
||||
The images that we use for OpenSUSE Leap 15.1 have an issue that makes the |
||||
nocloud backend[1] for cloud-init just not work. As a distro-specific |
||||
workaround, we're gonna pretend to be OpenStack. |
||||
|
||||
TODO(Xe): delete once we no longer need to support OpenSUSE Leap 15.1. |
||||
|
||||
[1]: https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
|
||||
*/ |
||||
|
||||
type openSUSELeap151MetaData struct { |
||||
Zone string `json:"availability_zone"` // nova
|
||||
Hostname string `json:"hostname"` // opensuse-leap-15-1
|
||||
LaunchIndex string `json:"launch_index"` // 0
|
||||
Meta openSUSELeap151MetaDataMeta `json:"meta"` // some openstack metadata we don't need to care about
|
||||
Name string `json:"name"` // opensuse-leap-15-1
|
||||
UUID string `json:"uuid"` // e9c664cd-b116-433b-aa61-7ff420163dcd
|
||||
} |
||||
|
||||
type openSUSELeap151MetaDataMeta struct { |
||||
Role string `json:"role"` // server
|
||||
DSMode string `json:"dsmode"` // local
|
||||
Essential string `json:"essential"` // essential
|
||||
} |
||||
|
||||
func hackOpenSUSE151UserData(t *testing.T, d Distro, dir string) bool { |
||||
if d.Name != "opensuse-leap-15-1" { |
||||
return false |
||||
} |
||||
|
||||
t.Log("doing OpenSUSE Leap 15.1 hack") |
||||
osDir := filepath.Join(dir, "openstack", "latest") |
||||
err := os.MkdirAll(osDir, 0755) |
||||
if err != nil { |
||||
t.Fatalf("can't make metadata home: %v", err) |
||||
} |
||||
|
||||
metadata, err := json.Marshal(openSUSELeap151MetaData{ |
||||
Zone: "nova", |
||||
Hostname: d.Name, |
||||
LaunchIndex: "0", |
||||
Meta: openSUSELeap151MetaDataMeta{ |
||||
Role: "server", |
||||
DSMode: "local", |
||||
Essential: "false", |
||||
}, |
||||
Name: d.Name, |
||||
UUID: uuid.New().String(), |
||||
}) |
||||
if err != nil { |
||||
t.Fatalf("can't encode metadata: %v", err) |
||||
} |
||||
err = os.WriteFile(filepath.Join(osDir, "meta_data.json"), metadata, 0666) |
||||
if err != nil { |
||||
t.Fatalf("can't write to meta_data.json: %v", err) |
||||
} |
||||
|
||||
data, err := os.ReadFile(filepath.Join(dir, "user-data")) |
||||
if err != nil { |
||||
t.Fatalf("can't read user_data: %v", err) |
||||
} |
||||
|
||||
err = os.WriteFile(filepath.Join(osDir, "user_data"), data, 0666) |
||||
if err != nil { |
||||
t.Fatalf("can't create output user_data: %v", err) |
||||
} |
||||
|
||||
return true |
||||
} |
||||
@ -1,29 +0,0 @@ |
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package vms |
||||
|
||||
import "regexp" |
||||
|
||||
type regexValue struct { |
||||
r *regexp.Regexp |
||||
} |
||||
|
||||
func (r *regexValue) String() string { |
||||
if r.r == nil { |
||||
return "" |
||||
} |
||||
|
||||
return r.r.String() |
||||
} |
||||
|
||||
func (r *regexValue) Set(val string) error { |
||||
if rex, err := regexp.Compile(val); err != nil { |
||||
return err |
||||
} else { |
||||
r.r = rex |
||||
return nil |
||||
} |
||||
} |
||||
|
||||
func (r regexValue) Unwrap() *regexp.Regexp { return r.r } |
||||
@ -1,21 +0,0 @@ |
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package vms |
||||
|
||||
import ( |
||||
"flag" |
||||
"testing" |
||||
) |
||||
|
||||
func TestRegexFlag(t *testing.T) { |
||||
var v regexValue |
||||
fs := flag.NewFlagSet(t.Name(), flag.PanicOnError) |
||||
fs.Var(&v, "regex", "regex to parse") |
||||
|
||||
const want = `.*` |
||||
fs.Parse([]string{"-regex", want}) |
||||
if v.Unwrap().String() != want { |
||||
t.Fatalf("got wrong regex: %q, wanted: %q", v.Unwrap().String(), want) |
||||
} |
||||
} |
||||
Loading…
Reference in new issue