package main // The holders of node-uplink whose bundles carry uplink.go (novox/hq ADR 0241). Each builds alone, so each // has its own copy; this test, itself one of the copied files, holds them to one text wherever the siblings // are present. import ( "bytes" "os" "path/filepath" "testing" ) var holders = []string{"networkmanager", "systemd-networkd"} func TestEveryUplinkHolderCarriesTheSameCopy(t *testing.T) { compared := 0 for _, module := range holders { dir := filepath.Join("..", "..", "..", module, "cmd", "uplink-tools") if _, err := os.Stat(dir); err != nil { continue } for _, f := range []string{"uplink.go", "uplink_test.go", "main.go", "copies_test.go"} { mine, err := os.ReadFile(f) if err != nil { t.Fatal(err) } theirs, err := os.ReadFile(filepath.Join(dir, f)) if err != nil || !bytes.Equal(mine, theirs) { t.Errorf("%s's copy of %s differs from this one: change every copy together", module, f) } } compared++ } if compared == 0 { t.Log("no sibling copies beside this module") } }