go.mod and go.sum move to mesh-sdk 14fd5cb68fd1, the commit on its main that holds go/catalogue, go/overlay and go/validate (ADR 0453 clause 2); vendor/modules.txt follows in the last of the six commits.
27 lines
1.1 KiB
Go
27 lines
1.1 KiB
Go
package builder
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// A context on a seat is cloned from the base the mesh sent, joined to the repository's path; a
|
|
// context by URL is itself; a seat the mesh sent no base for is refused by name (novox/hq ADR 0155).
|
|
func TestAContextOnASeatIsClonedFromTheBaseTheMeshSent(t *testing.T) {
|
|
seats := map[string]string{"git": "http://forge.example.tld:3000"}
|
|
got, err := contextURL(catalogue.ArtifactContext{Seat: "git", Repository: "org/controller"}, seats)
|
|
if err != nil || got != "http://forge.example.tld:3000/org/controller.git" {
|
|
t.Fatalf("got %q, %v", got, err)
|
|
}
|
|
got, err = contextURL(catalogue.ArtifactContext{Repository: "https://elsewhere.example/x.git"}, seats)
|
|
if err != nil || got != "https://elsewhere.example/x.git" {
|
|
t.Fatalf("a URL context was changed: %q, %v", got, err)
|
|
}
|
|
_, err = contextURL(catalogue.ArtifactContext{Seat: "git", Repository: "org/controller"}, nil)
|
|
if err == nil || !strings.Contains(err.Error(), "git seat") {
|
|
t.Fatalf("a seat with no base was not refused by name: %v", err)
|
|
}
|
|
}
|