Skip to content

Commit ceae96b

Browse files
authored
Merge pull request #496 from cloudfoundry/ginkgo-v2
refactor: migrate test suite from Ginkgo v1 to v2
2 parents 8422461 + 75a3923 commit ceae96b

421 files changed

Lines changed: 58465 additions & 20421 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go.mod

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
module github.com/cloudfoundry/staticfile-buildpack
22

3-
go 1.23.4
3+
go 1.24.0
44

55
require (
66
github.com/Dynatrace/libbuildpack-dynatrace v1.8.0
77
github.com/cloudfoundry/libbuildpack v0.0.0-20240717165421-f2ae8069fcba
88
github.com/cloudfoundry/switchblade v0.9.4
99
github.com/golang/mock v1.6.0
1010
github.com/kardolus/httpmock v0.0.0-20181110092731-53def6cd0f87
11-
github.com/onsi/ginkgo v1.16.5
12-
github.com/onsi/gomega v1.36.2
11+
github.com/onsi/ginkgo v1.16.5 // indirect
12+
github.com/onsi/gomega v1.39.0
1313
github.com/sclevine/spec v1.4.0
1414
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 // indirect
1515
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
1616
)
1717

18+
require github.com/onsi/ginkgo/v2 v2.28.1
19+
1820
require (
1921
code.cloudfoundry.org/lager v2.0.0+incompatible // indirect
2022
github.com/Masterminds/semver v1.5.0 // indirect
23+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2124
github.com/Microsoft/go-winio v0.6.1 // indirect
2225
github.com/blang/semver v3.5.1+incompatible // indirect
2326
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -30,18 +33,19 @@ require (
3033
github.com/felixge/httpsnoop v1.0.4 // indirect
3134
github.com/fsnotify/fsnotify v1.8.0 // indirect
3235
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
33-
github.com/go-logr/logr v1.4.2 // indirect
36+
github.com/go-logr/logr v1.4.3 // indirect
3437
github.com/go-logr/stdr v1.2.2 // indirect
38+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3539
github.com/gogo/protobuf v1.3.2 // indirect
36-
github.com/google/go-cmp v0.6.0 // indirect
40+
github.com/google/go-cmp v0.7.0 // indirect
41+
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect
3742
github.com/moby/docker-image-spec v1.3.1 // indirect
3843
github.com/nxadm/tail v1.4.11 // indirect
3944
github.com/opencontainers/go-digest v1.0.0 // indirect
4045
github.com/opencontainers/image-spec v1.1.0 // indirect
4146
github.com/paketo-buildpacks/packit v1.3.1 // indirect
4247
github.com/paketo-buildpacks/packit/v2 v2.16.0 // indirect
4348
github.com/pkg/errors v0.9.1 // indirect
44-
github.com/rogpeppe/go-internal v1.13.1 // indirect
4549
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
4650
github.com/tidwall/gjson v1.18.0 // indirect
4751
github.com/tidwall/match v1.1.1 // indirect
@@ -51,17 +55,17 @@ require (
5155
go.opentelemetry.io/otel v1.32.0 // indirect
5256
go.opentelemetry.io/otel/metric v1.32.0 // indirect
5357
go.opentelemetry.io/otel/trace v1.32.0 // indirect
54-
golang.org/x/mod v0.22.0 // indirect
55-
golang.org/x/net v0.35.0 // indirect
56-
golang.org/x/sync v0.11.0 // indirect
57-
golang.org/x/sys v0.30.0 // indirect
58-
golang.org/x/text v0.22.0 // indirect
59-
golang.org/x/tools v0.29.0 // indirect
58+
go.yaml.in/yaml/v3 v3.0.4 // indirect
59+
golang.org/x/mod v0.32.0 // indirect
60+
golang.org/x/net v0.49.0 // indirect
61+
golang.org/x/sync v0.19.0 // indirect
62+
golang.org/x/sys v0.40.0 // indirect
63+
golang.org/x/text v0.33.0 // indirect
64+
golang.org/x/tools v0.41.0 // indirect
6065
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
6166
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
6267
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
6368
gopkg.in/yaml.v2 v2.4.0 // indirect
64-
gopkg.in/yaml.v3 v3.0.1 // indirect
6569
)
6670

6771
exclude google.golang.org/genproto v0.0.0-20230403163135-ca9f95a91c1a

go.sum

Lines changed: 44 additions & 24 deletions
Large diffs are not rendered by default.

scripts/.util/tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function util::tools::ginkgo::install() {
4040
pushd /tmp > /dev/null || return
4141
GOBIN="${dir}" \
4242
go install \
43-
github.com/onsi/ginkgo/ginkgo@latest
43+
github.com/onsi/ginkgo/v2/ginkgo@latest
4444
popd > /dev/null || return
4545
fi
4646
}

src/staticfile/brats/brats_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/cloudfoundry/libbuildpack/bratshelper"
1212
"github.com/cloudfoundry/libbuildpack/cutlass"
1313

14-
. "github.com/onsi/ginkgo"
14+
. "github.com/onsi/ginkgo/v2"
1515
. "github.com/onsi/gomega"
1616
)
1717

src/staticfile/brats/brats_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package brats_test
22

33
import (
44
"github.com/cloudfoundry/libbuildpack/bratshelper"
5-
. "github.com/onsi/ginkgo"
5+
. "github.com/onsi/ginkgo/v2"
66
)
77

88
var _ = Describe("Staticfile buildpack", func() {

src/staticfile/finalize/finalize_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package finalize_test
22

33
import (
4-
. "github.com/onsi/ginkgo"
4+
. "github.com/onsi/ginkgo/v2"
55
. "github.com/onsi/gomega"
66

77
"testing"

src/staticfile/finalize/finalize_test.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/cloudfoundry/libbuildpack/ansicleaner"
1616
"github.com/golang/mock/gomock"
1717

18-
. "github.com/onsi/ginkgo"
18+
. "github.com/onsi/ginkgo/v2"
1919
. "github.com/onsi/gomega"
2020
)
2121

@@ -47,6 +47,13 @@ var _ = Describe("Compile", func() {
4747

4848
mockCtrl = gomock.NewController(GinkgoT())
4949
mockYaml = NewMockYAML(mockCtrl)
50+
DeferCleanup(func() {
51+
err = os.RemoveAll(buildDir)
52+
Expect(err).To(BeNil())
53+
54+
err = os.RemoveAll(depDir)
55+
Expect(err).To(BeNil())
56+
})
5057
})
5158

5259
JustBeforeEach(func() {
@@ -59,16 +66,6 @@ var _ = Describe("Compile", func() {
5966
}
6067
})
6168

62-
AfterEach(func() {
63-
mockCtrl.Finish()
64-
65-
err = os.RemoveAll(buildDir)
66-
Expect(err).To(BeNil())
67-
68-
err = os.RemoveAll(depDir)
69-
Expect(err).To(BeNil())
70-
})
71-
7269
Describe("WriteStartupFiles", func() {
7370
It("writes staticfile.sh to the profile.d directory", func() {
7471
err = finalizer.WriteStartupFiles()
@@ -908,9 +905,11 @@ var _ = Describe("Compile", func() {
908905
Expect(err).To(BeNil())
909906
})
910907

911-
AfterEach(func() {
912-
err = os.RemoveAll(appRootDir)
913-
Expect(err).To(BeNil())
908+
BeforeEach(func() {
909+
DeferCleanup(func() {
910+
err = os.RemoveAll(appRootDir)
911+
Expect(err).To(BeNil())
912+
})
914913
})
915914

916915
Context("The appRootDir is <buildDir>/public", func() {

src/staticfile/hooks/hooks_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"testing"
55

66
"github.com/kardolus/httpmock"
7-
. "github.com/onsi/ginkgo"
7+
. "github.com/onsi/ginkgo/v2"
88
. "github.com/onsi/gomega"
99
)
1010

src/staticfile/supply/supply_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package supply_test
22

33
import (
4-
. "github.com/onsi/ginkgo"
4+
. "github.com/onsi/ginkgo/v2"
55
. "github.com/onsi/gomega"
66

77
"testing"

src/staticfile/supply/supply_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/cloudfoundry/libbuildpack"
1212
"github.com/golang/mock/gomock"
1313

14-
. "github.com/onsi/ginkgo"
14+
. "github.com/onsi/ginkgo/v2"
1515
. "github.com/onsi/gomega"
1616
)
1717

@@ -47,6 +47,7 @@ var _ = Describe("Supply", func() {
4747
mockCtrl = gomock.NewController(GinkgoT())
4848
mockManifest = NewMockManifest(mockCtrl)
4949
mockInstaller = NewMockInstaller(mockCtrl)
50+
DeferCleanup(os.RemoveAll, depsDir)
5051
})
5152

5253
JustBeforeEach(func() {
@@ -61,13 +62,6 @@ var _ = Describe("Supply", func() {
6162
}
6263
})
6364

64-
AfterEach(func() {
65-
mockCtrl.Finish()
66-
67-
err = os.RemoveAll(depsDir)
68-
Expect(err).To(BeNil())
69-
})
70-
7165
Describe("InstallNginx", func() {
7266
BeforeEach(func() {
7367
dep := libbuildpack.Dependency{Name: "nginx", Version: "99.99"}

0 commit comments

Comments
 (0)