Skip to content

Commit 0eb4bd7

Browse files
authored
Merge pull request #372 from cloudfoundry/ginkgo-v2
refactor: migrate test suite from Ginkgo v1 to v2
2 parents 705110c + b03cc2d commit 0eb4bd7

429 files changed

Lines changed: 59289 additions & 20712 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: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
module github.com/cloudfoundry/nginx-buildpack
22

3-
go 1.23.0
4-
5-
toolchain go1.24.0
3+
go 1.24.0
64

75
require (
86
github.com/Dynatrace/libbuildpack-dynatrace v1.8.0
97
github.com/cloudfoundry/libbuildpack v0.0.0-20240717165421-f2ae8069fcba
108
github.com/cloudfoundry/switchblade v0.9.4
119
github.com/golang/mock v1.6.0
1210
github.com/miekg/dns v1.1.62
13-
github.com/onsi/ginkgo v1.16.5
14-
github.com/onsi/gomega v1.36.2
11+
github.com/onsi/ginkgo/v2 v2.28.1
12+
github.com/onsi/gomega v1.39.0
1513
github.com/sclevine/spec v1.4.0
1614
gopkg.in/yaml.v2 v2.4.0
1715
)
1816

1917
require (
2018
code.cloudfoundry.org/lager v2.0.0+incompatible // indirect
2119
github.com/Masterminds/semver v1.5.0 // indirect
20+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2221
github.com/Microsoft/go-winio v0.6.0 // indirect
2322
github.com/blang/semver v3.5.1+incompatible // indirect
2423
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -31,18 +30,20 @@ require (
3130
github.com/felixge/httpsnoop v1.0.4 // indirect
3231
github.com/fsnotify/fsnotify v1.8.0 // indirect
3332
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
34-
github.com/go-logr/logr v1.4.2 // indirect
33+
github.com/go-logr/logr v1.4.3 // indirect
3534
github.com/go-logr/stdr v1.2.2 // indirect
35+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3636
github.com/gogo/protobuf v1.3.2 // indirect
37-
github.com/google/go-cmp v0.6.0 // indirect
37+
github.com/google/go-cmp v0.7.0 // indirect
38+
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect
3839
github.com/moby/docker-image-spec v1.3.1 // indirect
3940
github.com/nxadm/tail v1.4.11 // indirect
41+
github.com/onsi/ginkgo v1.16.5 // indirect
4042
github.com/opencontainers/go-digest v1.0.0 // indirect
4143
github.com/opencontainers/image-spec v1.1.0 // indirect
4244
github.com/paketo-buildpacks/packit v1.3.1 // indirect
4345
github.com/paketo-buildpacks/packit/v2 v2.16.0 // indirect
4446
github.com/pkg/errors v0.9.1 // indirect
45-
github.com/rogpeppe/go-internal v1.13.1 // indirect
4647
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
4748
github.com/tidwall/gjson v1.18.0 // indirect
4849
github.com/tidwall/match v1.1.1 // indirect
@@ -54,16 +55,16 @@ require (
5455
go.opentelemetry.io/otel/metric v1.32.0 // indirect
5556
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
5657
go.opentelemetry.io/otel/trace v1.32.0 // indirect
57-
golang.org/x/mod v0.22.0 // indirect
58-
golang.org/x/net v0.34.0 // indirect
59-
golang.org/x/sync v0.10.0 // indirect
60-
golang.org/x/sys v0.29.0 // indirect
61-
golang.org/x/text v0.21.0 // indirect
62-
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
6365
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
6466
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
6567
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
66-
gopkg.in/yaml.v3 v3.0.1 // indirect
6768
)
6869

6970
exclude google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd

go.sum

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

src/nginx/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/nginx/brats/brats_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package brats_test
33
import (
44
"github.com/cloudfoundry/libbuildpack/bratshelper"
55
"github.com/cloudfoundry/libbuildpack/cutlass"
6-
. "github.com/onsi/ginkgo"
6+
. "github.com/onsi/ginkgo/v2"
77
. "github.com/onsi/gomega"
88
)
99

src/nginx/supply/cli/cli_suite_test.go

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

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

77
"testing"

src/nginx/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/nginx/supply/supply_test.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/cloudfoundry/nginx-buildpack/src/nginx/supply"
1313
"github.com/golang/mock/gomock"
1414

15-
. "github.com/onsi/ginkgo"
15+
. "github.com/onsi/ginkgo/v2"
1616
. "github.com/onsi/gomega"
1717
)
1818

@@ -43,15 +43,11 @@ var _ = Describe("Supply", func() {
4343
mockCommand = NewMockCommand(mockCtrl)
4444
depDir, err = ioutil.TempDir("", "nginx.depdir")
4545
Expect(err).ToNot(HaveOccurred())
46+
DeferCleanup(os.RemoveAll, depDir)
4647
mockStager.EXPECT().DepDir().AnyTimes().Return(depDir)
4748
supplier = supply.New(mockStager, mockManifest, mockInstaller, logger, mockCommand)
4849
})
4950

50-
AfterEach(func() {
51-
mockCtrl.Finish()
52-
os.RemoveAll(depDir)
53-
})
54-
5551
Describe("InstallNGINX", func() {
5652
BeforeEach(func() {
5753
supplier.VersionLines = map[string]string{"": "1.13.x", "mainline": "1.13.x", "stable": "1.12.x"}
@@ -209,16 +205,13 @@ var _ = Describe("Supply", func() {
209205
BeforeEach(func() {
210206
buildDir, err = ioutil.TempDir("", "")
211207
Expect(err).NotTo(HaveOccurred())
208+
DeferCleanup(os.RemoveAll, buildDir)
212209

213210
mockStager.EXPECT().BuildDir().Return(buildDir).AnyTimes()
214211

215212
mockCommand.EXPECT().Execute(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
216213
})
217214

218-
AfterEach(func() {
219-
os.RemoveAll(buildDir)
220-
})
221-
222215
It("calls varify to parse the port", func() {
223216
nginxConfPath := filepath.Join(buildDir, "nginx.conf")
224217
err := ioutil.WriteFile(nginxConfPath, []byte("{{port}}"), 0666)

src/nginx/varify/cli/varify_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"path/filepath"
77
"testing"
88

9-
. "github.com/onsi/ginkgo"
9+
. "github.com/onsi/ginkgo/v2"
1010
. "github.com/onsi/gomega"
1111
"github.com/onsi/gomega/gexec"
1212
)

src/nginx/varify/cli/varify_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
"path/filepath"
88

9-
. "github.com/onsi/ginkgo"
9+
. "github.com/onsi/ginkgo/v2"
1010
. "github.com/onsi/gomega"
1111
"github.com/onsi/gomega/gbytes"
1212
)
@@ -20,10 +20,7 @@ var _ = Describe("varify", func() {
2020
var err error
2121
tmpDir, err = ioutil.TempDir("", "nginx.tmpdir")
2222
Expect(err).ToNot(HaveOccurred())
23-
})
24-
25-
AfterEach(func() {
26-
os.RemoveAll(tmpDir)
23+
DeferCleanup(os.RemoveAll, tmpDir)
2724
})
2825

2926
Describe("Run", func() {

vendor/github.com/Masterminds/semver/v3/.gitignore

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)