labctl: dépôt autonome — module git.g3e.fr/syonad/labctl, exemple evpn-2hv, LABCTL_BIN, licence, README, CI
Some checks failed
Tests / test (push) Successful in 4m12s
Release Pipeline / set-release-target (push) Successful in 2s
Release Pipeline / upload-assets (lab-host.sh, scripts/lab-host.sh) (push) Successful in 7s
Release Pipeline / build (push) Successful in 1m31s
Release Pipeline / build (amd64, linux) (push) Successful in 0s
Release Pipeline / build (arm64, darwin) (push) Successful in 0s
Release Pipeline / checksums (push) Successful in 6s
Release Pipeline / release (push) Failing after 22s
Release Pipeline / publish (push) Failing after 0s
Some checks failed
Tests / test (push) Successful in 4m12s
Release Pipeline / set-release-target (push) Successful in 2s
Release Pipeline / upload-assets (lab-host.sh, scripts/lab-host.sh) (push) Successful in 7s
Release Pipeline / build (push) Successful in 1m31s
Release Pipeline / build (amd64, linux) (push) Successful in 0s
Release Pipeline / build (arm64, darwin) (push) Successful in 0s
Release Pipeline / checksums (push) Successful in 6s
Release Pipeline / release (push) Failing after 22s
Release Pipeline / publish (push) Failing after 0s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
070faec37a
commit
ef7392f09b
31 changed files with 766 additions and 36 deletions
|
|
@ -13,8 +13,8 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"git.g3e.fr/syonad/two/internal/lab/machine"
|
||||
"git.g3e.fr/syonad/two/internal/lab/provision"
|
||||
"git.g3e.fr/syonad/labctl/internal/machine"
|
||||
"git.g3e.fr/syonad/labctl/internal/provision"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"git.g3e.fr/syonad/two/internal/lab/provision"
|
||||
"git.g3e.fr/syonad/two/internal/lab/render"
|
||||
"git.g3e.fr/syonad/two/internal/lab/topology"
|
||||
"git.g3e.fr/syonad/labctl/internal/provision"
|
||||
"git.g3e.fr/syonad/labctl/internal/render"
|
||||
"git.g3e.fr/syonad/labctl/internal/topology"
|
||||
)
|
||||
|
||||
const usage = `usage: labctl <command> [options] <topology.yml> [dir]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func TestRun_UsageOnMissingArguments(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRun_PlanOfTheShippedExampleTopology(t *testing.T) {
|
||||
code, stdout, stderr := runLab("plan", filepath.Join("..", "..", "test", "e2e", "topologies", "evpn-2hv.yml"))
|
||||
code, stdout, stderr := runLab("plan", filepath.Join("..", "..", "examples", "evpn-2hv", "topology.yml"))
|
||||
if code != 0 {
|
||||
t.Fatalf("code %d, stderr %s", code, stderr)
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ func TestRun_RenderWritesEveryNodeFiles(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
out := filepath.Join(dir, "run")
|
||||
code, stdout, stderr := runLab("render", "-key", key, filepath.Join("..", "..", "test", "e2e", "topologies", "evpn-2hv.yml"), out)
|
||||
code, stdout, stderr := runLab("render", "-key", key, filepath.Join("..", "..", "examples", "evpn-2hv", "topology.yml"), out)
|
||||
if code != 0 {
|
||||
t.Fatalf("code %d, stderr %s", code, stderr)
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ func TestRun_RenderWritesEveryNodeFiles(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRun_RenderRefusesMissingKeyFile(t *testing.T) {
|
||||
code, _, stderr := runLab("render", "-key", filepath.Join(t.TempDir(), "absent.pub"), filepath.Join("..", "..", "test", "e2e", "topologies", "evpn-2hv.yml"), t.TempDir())
|
||||
code, _, stderr := runLab("render", "-key", filepath.Join(t.TempDir(), "absent.pub"), filepath.Join("..", "..", "examples", "evpn-2hv", "topology.yml"), t.TempDir())
|
||||
if code != 1 || !strings.Contains(stderr, "absent.pub") {
|
||||
t.Errorf("code %d, stderr %q", code, stderr)
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ func savedLab(t *testing.T) string {
|
|||
if err := os.MkdirAll(run, 0o700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
example, err := os.ReadFile(filepath.Join("..", "..", "test", "e2e", "topologies", "evpn-2hv.yml"))
|
||||
example, err := os.ReadFile(filepath.Join("..", "..", "examples", "evpn-2hv", "topology.yml"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -308,15 +308,15 @@ func TestRun_RenderShipsTheExampleFRRConfigs(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
out := filepath.Join(dir, "run")
|
||||
code, _, stderr := runLab("render", "-key", key, filepath.Join("..", "..", "test", "e2e", "topologies", "evpn-2hv.yml"), out)
|
||||
code, _, stderr := runLab("render", "-key", key, filepath.Join("..", "..", "examples", "evpn-2hv", "topology.yml"), out)
|
||||
if code != 0 {
|
||||
t.Fatalf("code %d, stderr %s", code, stderr)
|
||||
}
|
||||
for node, wants := range map[string][]string{
|
||||
"sw1": {"router bgp 65100"},
|
||||
"rr1": {"bgp listen range 192.168.14.0/24 peer-group fabric"},
|
||||
"hv1": {"hostname hv1"},
|
||||
"hv2": {"hostname hv2"},
|
||||
"hv1": {"hostname hv1", "neighbor 10.255.255.1 peer-group fabric"},
|
||||
"hv2": {"hostname hv2", "neighbor 10.255.255.1 peer-group fabric"},
|
||||
} {
|
||||
data, err := os.ReadFile(filepath.Join(out, node, "user-data"))
|
||||
if err != nil {
|
||||
|
|
@ -337,10 +337,13 @@ func TestRun_RenderShipsTheExampleFRRConfigs(t *testing.T) {
|
|||
t.Errorf("%s user-data does not mount its files", node)
|
||||
}
|
||||
}
|
||||
for _, agent := range []string{"two.yml", "bgp.yml"} {
|
||||
data, err := os.ReadFile(filepath.Join("..", "..", "test", "e2e", "topologies", "agent", agent))
|
||||
if err != nil || !strings.Contains(string(data), "route_reflectors: [10.255.255.1]") {
|
||||
t.Errorf("agent/%s = %q, %v", agent, data, err)
|
||||
for _, node := range []string{"hv1", "hv2"} {
|
||||
data, err := os.ReadFile(filepath.Join(out, node, "user-data"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(data), "LAB_NODE="+node+" LAB_UPLINK=underlay LAB_FILES=/etc/lab/files /usr/local/sbin/lab-node-provision") {
|
||||
t.Errorf("%s user-data does not run the example provision", node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue