Skip to content

Commit a9649d5

Browse files
committed
refactor: standardize Ginkgo suite initialization across all test packages
Separate suite initialization from test specs by creating dedicated *_suite_test.go files for consistency and maintainability. Changes: - Created dedicated suite files for containers, finalize, jres, and supply packages - Moved TestXxx() functions and RunSpecs() calls to respective suite files - Removed 'testing' import from test files that no longer need it - Follows Ginkgo best practices and community standards All 294 specs verified passing with identical counts before and after refactoring.
1 parent 9cb2541 commit a9649d5

9 files changed

Lines changed: 65 additions & 24 deletions

File tree

src/java/containers/container_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package containers_test
33
import (
44
"os"
55
"path/filepath"
6-
"testing"
76

87
"github.com/cloudfoundry/java-buildpack/src/java/common"
98
"github.com/cloudfoundry/java-buildpack/src/java/containers"
@@ -12,11 +11,6 @@ import (
1211
. "github.com/onsi/gomega"
1312
)
1413

15-
func TestContainers(t *testing.T) {
16-
RegisterFailHandler(Fail)
17-
RunSpecs(t, "Containers Suite")
18-
}
19-
2014
var _ = Describe("Container Registry", func() {
2115
var (
2216
ctx *common.Context
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package containers_test
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
)
9+
10+
func TestContainers(t *testing.T) {
11+
RegisterFailHandler(Fail)
12+
RunSpecs(t, "Containers Suite")
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package finalize_test
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
)
9+
10+
func TestFinalize(t *testing.T) {
11+
RegisterFailHandler(Fail)
12+
RunSpecs(t, "Finalize Suite")
13+
}

src/java/finalize/finalize_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package finalize_test
33
import (
44
"os"
55
"path/filepath"
6-
"testing"
76
"time"
87

98
"github.com/cloudfoundry/java-buildpack/src/java/finalize"
@@ -12,11 +11,6 @@ import (
1211
. "github.com/onsi/gomega"
1312
)
1413

15-
func TestFinalize(t *testing.T) {
16-
RegisterFailHandler(Fail)
17-
RunSpecs(t, "Finalize Suite")
18-
}
19-
2014
var _ = Describe("Finalize", func() {
2115
var (
2216
buildDir string
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package frameworks_test
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
)
9+
10+
func TestFrameworks(t *testing.T) {
11+
RegisterFailHandler(Fail)
12+
RunSpecs(t, "Frameworks Suite")
13+
}

src/java/jres/jre_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package jres_test
33
import (
44
"os"
55
"path/filepath"
6-
"testing"
76
"time"
87

98
"github.com/cloudfoundry/java-buildpack/src/java/common"
@@ -13,11 +12,6 @@ import (
1312
. "github.com/onsi/gomega"
1413
)
1514

16-
func TestJREs(t *testing.T) {
17-
RegisterFailHandler(Fail)
18-
RunSpecs(t, "JREs Suite")
19-
}
20-
2115
var _ = Describe("JRE Registry", func() {
2216
var (
2317
ctx *common.Context

src/java/jres/jres_suite_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package jres_test
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
)
9+
10+
func TestJREs(t *testing.T) {
11+
RegisterFailHandler(Fail)
12+
RunSpecs(t, "JREs Suite")
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package supply_test
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
)
9+
10+
func TestSupply(t *testing.T) {
11+
RegisterFailHandler(Fail)
12+
RunSpecs(t, "Supply Suite")
13+
}

src/java/supply/supply_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package supply_test
33
import (
44
"os"
55
"path/filepath"
6-
"testing"
76
"time"
87

98
"github.com/cloudfoundry/java-buildpack/src/java/supply"
@@ -12,11 +11,6 @@ import (
1211
. "github.com/onsi/gomega"
1312
)
1413

15-
func TestSupply(t *testing.T) {
16-
RegisterFailHandler(Fail)
17-
RunSpecs(t, "Supply Suite")
18-
}
19-
2014
var _ = Describe("Supply", func() {
2115
var (
2216
buildDir string

0 commit comments

Comments
 (0)