Skip to content

Commit

Permalink
Revert "remove go version check"
Browse files Browse the repository at this point in the history
This reverts commit 27df7fb.
  • Loading branch information
janisar007 committed Dec 4, 2024
1 parent 27df7fb commit 47b2f38
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 22 deletions.
2 changes: 2 additions & 0 deletions integration/build_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func testBuildFlags(t *testing.T, context spec.G, it spec.S) {
Eventually(container).Should(
Serve(
SatisfyAll(
ContainSubstring("go1.21"),
ContainSubstring(`variable value: "some-value"`),
ContainSubstring("/workspace contents: []"),
),
Expand Down Expand Up @@ -122,6 +123,7 @@ func testBuildFlags(t *testing.T, context spec.G, it spec.S) {
Eventually(container).Should(
Serve(
SatisfyAll(
ContainSubstring("go1.21"),
ContainSubstring(`variable value: "env-value"`),
ContainSubstring("/workspace contents: []"),
),
Expand Down
26 changes: 19 additions & 7 deletions integration/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(container).Should(
Serve(
SatisfyAll(
ContainSubstring("go1.21"),
ContainSubstring("/workspace contents: []"),
),
).OnPort(8080),
)

Expect(logs).To(ContainLines(
MatchRegexp(fmt.Sprintf(`%s \d+\.\d+\.\d+`, settings.Buildpack.Name)),
Expand Down Expand Up @@ -165,8 +172,7 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))

Eventually(container).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))
})
})

Expand Down Expand Up @@ -214,7 +220,14 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(container).Should(
Serve(
SatisfyAll(
ContainSubstring("go1.21"),
ContainSubstring("/workspace contents: []"),
),
).OnPort(8080),
)
})
})

Expand Down Expand Up @@ -270,8 +283,7 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))

Eventually(container).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))

Expect(logs).To(ContainLines(
" Assigning launch processes:",
Expand All @@ -287,7 +299,7 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(noReloadContainer).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(noReloadContainer).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))
})
})
}
9 changes: 8 additions & 1 deletion integration/import_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ func testImportPath(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(container).Should(
Serve(
SatisfyAll(
ContainSubstring("go1.21"),
ContainSubstring("/workspace contents: []"),
),
).OnPort(8080),
)
})
})
}
1 change: 1 addition & 0 deletions integration/keep_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func testKeepFiles(t *testing.T, context spec.G, it spec.S) {
Eventually(container).Should(
Serve(
SatisfyAll(
ContainSubstring("go1.21"),
ContainSubstring("/workspace contents: [/workspace/assets /workspace/static-file]"),
ContainSubstring("file contents: Hello world!"),
),
Expand Down
4 changes: 2 additions & 2 deletions integration/mod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func testMod(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))

// check that all required SBOM files are present
Expect(filepath.Join(sbomDir, "sbom", "launch", strings.ReplaceAll(settings.Buildpack.ID, "/", "_"), "targets", "sbom.cdx.json")).To(BeARegularFile())
Expand Down Expand Up @@ -119,7 +119,7 @@ func testMod(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))

// check that all required SBOM files are present
Expect(filepath.Join(sbomDir, "sbom", "launch", strings.ReplaceAll(settings.Buildpack.ID, "/", "_"), "targets", "sbom.cdx.json")).To(BeARegularFile())
Expand Down
4 changes: 2 additions & 2 deletions integration/targets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func testTargets(t *testing.T, context spec.G, it spec.S) {
Expect(err).NotTo(HaveOccurred())
containerIDs[container.ID] = struct{}{}

Eventually(container).Should(Serve(ContainSubstring("first: go")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("first: go1.21")).OnPort(8080))

Expect(logs).To(ContainLines(
" Assigning launch processes:",
Expand All @@ -104,7 +104,7 @@ func testTargets(t *testing.T, context spec.G, it spec.S) {
Expect(err).NotTo(HaveOccurred())
containerIDs[container.ID] = struct{}{}

Eventually(container).Should(Serve(ContainSubstring("second: go")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("second: go1.21")).OnPort(8080))

// check that all required SBOM files are present
Expect(filepath.Join(sbomDir, "sbom", "launch", strings.ReplaceAll(settings.Buildpack.ID, "/", "_"), "targets", "sbom.cdx.json")).To(BeARegularFile())
Expand Down
4 changes: 0 additions & 4 deletions integration/testdata/mod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"log"
"net/http"
"os"
"path/filepath"
"runtime"

"github.com/gorilla/mux"
Expand All @@ -15,9 +14,6 @@ func main() {
router := mux.NewRouter()
router.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintln(w, runtime.Version())

paths, _ := filepath.Glob("/workspace/*")
fmt.Fprintf(w, "/workspace contents: %v\n", paths)
})

log.Fatal(http.ListenAndServe(":"+os.Getenv("PORT"), router))
Expand Down
4 changes: 0 additions & 4 deletions integration/testdata/vendor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"log"
"net/http"
"os"
"path/filepath"
"runtime"

"github.com/gorilla/mux"
Expand All @@ -19,9 +18,6 @@ func main() {
router := mux.NewRouter()
router.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintln(w, runtime.Version())

paths, _ := filepath.Glob("/workspace/*")
fmt.Fprintf(w, "/workspace contents: %v\n", paths)
})

log.Fatal(http.ListenAndServe(":"+os.Getenv("PORT"), router))
Expand Down
4 changes: 2 additions & 2 deletions integration/vendor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func testVendor(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))
})
})

Expand Down Expand Up @@ -120,7 +120,7 @@ func testVendor(t *testing.T, context spec.G, it spec.S) {
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(Serve(ContainSubstring("/workspace contents: []")).OnPort(8080))
Eventually(container).Should(Serve(ContainSubstring("go1.21")).OnPort(8080))
})
})
}

0 comments on commit 47b2f38

Please sign in to comment.