Skip to content

Commit 489ab22

Browse files
Arjun Sreedharanarjun024
authored andcommitted
fix tests: fs3 envs do not have go_buildpack
See cloudfoundry/nodejs-buildpack#692
1 parent 5e6a591 commit 489ab22

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

src/ruby/integration/init_test.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ package integration_test
22

33
import (
44
"flag"
5+
"fmt"
6+
"io"
7+
"net/http"
58
"os"
69
"path/filepath"
710
"testing"
@@ -51,6 +54,9 @@ func TestIntegration(t *testing.T) {
5154
platform, err := switchblade.NewPlatform(settings.Platform, settings.GitHubToken, settings.Stack)
5255
Expect(err).NotTo(HaveOccurred())
5356

57+
goBuildpackFile, err := downloadBuildpack("go")
58+
Expect(err).NotTo(HaveOccurred())
59+
5460
err = platform.Initialize(
5561
switchblade.Buildpack{
5662
Name: "ruby_buildpack",
@@ -62,7 +68,7 @@ func TestIntegration(t *testing.T) {
6268
},
6369
switchblade.Buildpack{
6470
Name: "go_buildpack", // for the proxy test
65-
URI: "https://github.com/cloudfoundry/go-buildpack/releases/download/v1.10.21/go-buildpack-cflinuxfs4-v1.10.21.zip",
71+
URI: goBuildpackFile,
6672
},
6773
)
6874
Expect(err).NotTo(HaveOccurred())
@@ -91,4 +97,24 @@ func TestIntegration(t *testing.T) {
9197

9298
Expect(platform.Delete.Execute(proxyName)).To(Succeed())
9399
Expect(os.Remove(os.Getenv("BUILDPACK_FILE"))).To(Succeed())
100+
Expect(os.Remove(goBuildpackFile)).To(Succeed())
101+
}
102+
103+
func downloadBuildpack(name string) (string, error) {
104+
uri := fmt.Sprintf("https://github.com/cloudfoundry/%s-buildpack/archive/master.zip", name)
105+
106+
file, err := os.CreateTemp("", fmt.Sprintf("%s-buildpack-*.zip", name))
107+
if err != nil {
108+
return "", err
109+
}
110+
defer file.Close()
111+
112+
resp, err := http.Get(uri)
113+
if err != nil {
114+
return "", err
115+
}
116+
defer resp.Body.Close()
117+
118+
_, err = io.Copy(file, resp.Body)
119+
return file.Name(), err
94120
}

0 commit comments

Comments
 (0)