Accept equivalent checkout paths in build receipts
This commit is contained in:
@@ -14,10 +14,12 @@ func TestBuildAndPrebuiltDeliveryUseSameDirectoryBase(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
name, module string
|
||||
absolute bool
|
||||
alias bool
|
||||
}{
|
||||
{name: "root relative"},
|
||||
{name: "nested relative", module: "apps/widget"},
|
||||
{name: "nested absolute", module: "apps/widget", absolute: true},
|
||||
{name: "nested checkout alias", module: "apps/widget", absolute: true, alias: true},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
repository := newDeliveryBuildRepository(t)
|
||||
@@ -53,7 +55,14 @@ func TestBuildAndPrebuiltDeliveryUseSameDirectoryBase(t *testing.T) {
|
||||
resolved = output
|
||||
}
|
||||
var stdout, stderr bytes.Buffer
|
||||
if status := run(context.Background(), []string{"build", "--repo", repository, "--output", output, "v1.2.3"}, &stdout, &stderr); status != 0 {
|
||||
invocationRepository := repository
|
||||
if tt.alias {
|
||||
invocationRepository = filepath.Join(t.TempDir(), "checkout-alias")
|
||||
if err := os.Symlink(repository, invocationRepository); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if status := run(context.Background(), []string{"build", "--repo", invocationRepository, "--output", output, "v1.2.3"}, &stdout, &stderr); status != 0 {
|
||||
t.Fatalf("build status=%d, stderr=%s", status, stderr.String())
|
||||
}
|
||||
receipt, err := cli.LoadBuildReceipt(filepath.Join(resolved, cli.BuildReceiptName))
|
||||
@@ -61,12 +70,17 @@ func TestBuildAndPrebuiltDeliveryUseSameDirectoryBase(t *testing.T) {
|
||||
t.Fatalf("build receipt=%#v, error=%v", receipt, err)
|
||||
}
|
||||
t.Setenv("RELEASEKIT_GITEA_TOKEN", "fixture-token")
|
||||
args := []string{"deliver", "--repo", repository, "--assets", output, "v1.2.3"}
|
||||
args := []string{"deliver", "--repo", invocationRepository, "--assets", output, "v1.2.3"}
|
||||
stdout.Reset()
|
||||
stderr.Reset()
|
||||
if status := run(context.Background(), args, &stdout, &stderr); status != 0 || state.releaseCreates != 1 || state.assetUploads != 2 {
|
||||
t.Fatalf("delivery status=%d, creates=%d, uploads=%d, stderr=%s", status, state.releaseCreates, state.assetUploads, stderr.String())
|
||||
}
|
||||
if tt.alias {
|
||||
if status := run(context.Background(), []string{"deliver", "--repo", repository, "--assets", output, "v1.2.3"}, &stdout, &stderr); status != 0 || state.assetUploads != 2 {
|
||||
t.Fatalf("physical-path retry status=%d, uploads=%d, stderr=%s", status, state.assetUploads, stderr.String())
|
||||
}
|
||||
}
|
||||
if tt.module != "" {
|
||||
cliGitRun(t, repository, "tag", "v1.2.3")
|
||||
wrongModule := settings
|
||||
|
||||
Reference in New Issue
Block a user