Skip to content

Commit 1e4f08f

Browse files
author
Aaron Schlesinger
committed
fix(slug_builder_info.go,slug_builder_info_test.go): fix push URL endpoint
and enhance tests to look for it
1 parent ce7fed1 commit 1e4f08f

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

pkg/gitreceive/storage/slug_builder_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ type SlugBuilderInfo struct {
1818
func NewSlugBuilderInfo(s3Endpoint, appName, slugName string, gitSha *git.SHA) *SlugBuilderInfo {
1919
tarKey := fmt.Sprintf("home/%s/tar", slugName)
2020
// this is where workflow tells slugrunner to download the slug from, so we have to tell slugbuilder to upload it to here
21-
pushKey := fmt.Sprintf("home/%s:git-%s/push", appName, gitSha.Short)
21+
pushKey := fmt.Sprintf("home/%s:git-%s/push", appName, gitSha.Full)
2222

2323
return &SlugBuilderInfo{
2424
PushKey: pushKey,
25-
PushURL: fmt.Sprintf("%s/%s", s3Endpoint, pushKey),
25+
PushURL: fmt.Sprintf("%s/git/%s", s3Endpoint, pushKey),
2626
TarKey: tarKey,
2727
TarURL: fmt.Sprintf("%s/git/%s", s3Endpoint, tarKey),
2828
}

pkg/gitreceive/storage/slug_builder_info_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package storage
22

33
import (
4-
"strings"
54
"testing"
65

76
"github.com/deis/builder/pkg/gitreceive/git"
@@ -20,10 +19,13 @@ func TestS3Endpoint(t *testing.T) {
2019
t.Fatalf("error building git sha (%s)", err)
2120
}
2221
sbi := NewSlugBuilderInfo(s3Endpoint, appName, slugName, sha)
23-
if !strings.HasPrefix(sbi.PushURL, s3Endpoint) {
24-
t.Errorf("push URL %s didn't have expected s3 endpoint prefix %s", sbi.PushURL, s3Endpoint)
22+
23+
expectedPushURL := s3Endpoint + "/git/" + sbi.PushKey
24+
if sbi.PushURL != expectedPushURL {
25+
t.Errorf("push URL %s didn't match expected %s", sbi.PushURL, expectedPushURL)
2526
}
26-
if !strings.HasPrefix(sbi.TarURL, s3Endpoint) {
27-
t.Errorf("tar URL %s didn't have expected s3 endpoint prefix %s", sbi.TarURL, s3Endpoint)
27+
expectedTarURL := s3Endpoint + "/git/" + sbi.TarKey
28+
if sbi.TarURL != expectedTarURL {
29+
t.Errorf("tar URL %s didn't match expected %s", sbi.TarURL, expectedTarURL)
2830
}
2931
}

0 commit comments

Comments
 (0)