27 lines
888 B
Go
27 lines
888 B
Go
//go:build integration
|
|
|
|
package builder
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestAnImageIsPushedOnlyAfterItsBasesAreLent(t *testing.T) {
|
|
r, workspace := aRepository(t, anImage, map[string]string{"modules/bus/Dockerfile": "ARG BASE\nFROM ${BASE}"})
|
|
r.contents["modules/bus/module.json"] = anImage
|
|
l := &lending{mirroring: &mirroring{recorded: r, at: "127.0.0.1:5000"}}
|
|
if _, err := Build(context.Background(), r.run, l, "https://forge.invalid/catalogue.git", "modules/bus", "", workspace,
|
|
nil, Npmrc{}, GitCredential{}, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want := []string{
|
|
"lend bus/server 127.0.0.1:5000/upstream/docker.io/vendor/server@sha256:" + strings.Repeat("1", 64),
|
|
"push bus/server",
|
|
}
|
|
if strings.Join(l.order, "\n") != strings.Join(want, "\n") {
|
|
t.Fatalf("the build did:\n%s\nwant:\n%s", strings.Join(l.order, "\n"), strings.Join(want, "\n"))
|
|
}
|
|
}
|