Skip to content

Commit 49ddb19

Browse files
committed
HAWNG-1855: Refactors the hawtiotest tests inside an internal package
* Prevents the test API being public in the project as no need to expose it * test_functions.go * Adds a FindProjectRoot function that walks up the directory structure to locate go.mod so avoiding the need to add copious .. paths when locating the CRD files in the tests.
1 parent 0958bd9 commit 49ddb19

17 files changed

Lines changed: 29 additions & 7 deletions

pkg/controller/hawtiotest/kubernetes/config/config.yaml renamed to pkg/controller/internal/hawtiotest/kubernetes/config/config.yaml

File renamed without changes.

pkg/controller/hawtiotest/kubernetes/controller_integration_kubernetes_test.go renamed to pkg/controller/internal/hawtiotest/kubernetes/controller_integration_kubernetes_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"k8s.io/apimachinery/pkg/types"
1414

15-
"github.com/hawtio/hawtio-operator/pkg/controller/hawtiotest"
15+
"github.com/hawtio/hawtio-operator/pkg/controller/internal/hawtiotest"
1616
)
1717

1818
var _ = Describe("Testing the Hawtio Controller", Ordered, func() {

pkg/controller/hawtiotest/kubernetes/suite_test.go renamed to pkg/controller/internal/hawtiotest/kubernetes/suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"github.com/hawtio/hawtio-operator/pkg/clients"
2121

22-
"github.com/hawtio/hawtio-operator/pkg/controller/hawtiotest"
22+
"github.com/hawtio/hawtio-operator/pkg/controller/internal/hawtiotest"
2323
hawtiomgr "github.com/hawtio/hawtio-operator/pkg/manager"
2424
)
2525

@@ -48,7 +48,7 @@ var _ = BeforeSuite(func() {
4848
testEnv = &envtest.Environment{
4949
// CRDDirectoryPaths tells envtest where to find your CRD YAMLs
5050
CRDDirectoryPaths: []string{
51-
filepath.Join("..", "..", "..", "..", "deploy", "crd"),
51+
filepath.Join(hawtiotest.FindProjectRoot(), "deploy", "crd"),
5252
},
5353
ErrorIfCRDPathMissing: true,
5454
DownloadBinaryAssets: true,

pkg/controller/hawtiotest/kubernetes/testdata/configmap.yml renamed to pkg/controller/internal/hawtiotest/kubernetes/testdata/configmap.yml

File renamed without changes.

pkg/controller/hawtiotest/kubernetes/testdata/deployment.yml renamed to pkg/controller/internal/hawtiotest/kubernetes/testdata/deployment.yml

File renamed without changes.

pkg/controller/hawtiotest/openshift/config/config.yaml renamed to pkg/controller/internal/hawtiotest/openshift/config/config.yaml

File renamed without changes.

pkg/controller/hawtiotest/openshift/controller_integration_openshift_test.go renamed to pkg/controller/internal/hawtiotest/openshift/controller_integration_openshift_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
hawtiov2 "github.com/hawtio/hawtio-operator/pkg/apis/hawtio/v2"
2424

25-
"github.com/hawtio/hawtio-operator/pkg/controller/hawtiotest"
25+
"github.com/hawtio/hawtio-operator/pkg/controller/internal/hawtiotest"
2626
)
2727

2828
var _ = Describe("Testing the Hawtio Controller", Ordered, func() {

pkg/controller/hawtiotest/openshift/suite_test.go renamed to pkg/controller/internal/hawtiotest/openshift/suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"github.com/hawtio/hawtio-operator/pkg/clients"
2121

22-
"github.com/hawtio/hawtio-operator/pkg/controller/hawtiotest"
22+
"github.com/hawtio/hawtio-operator/pkg/controller/internal/hawtiotest"
2323
hawtiomgr "github.com/hawtio/hawtio-operator/pkg/manager"
2424
)
2525

@@ -48,7 +48,7 @@ var _ = BeforeSuite(func() {
4848
testEnv = &envtest.Environment{
4949
// CRDDirectoryPaths tells envtest where to find your CRD YAMLs
5050
CRDDirectoryPaths: []string{
51-
filepath.Join("..", "..", "..", "..", "deploy", "crd"),
51+
filepath.Join(hawtiotest.FindProjectRoot(), "deploy", "crd"),
5252

5353
// Point directly to the OpenShift CRDs in your vendor dir
5454
filepath.Join("testdata", "crds"),

pkg/controller/hawtiotest/openshift/testdata/configmap.yml renamed to pkg/controller/internal/hawtiotest/openshift/testdata/configmap.yml

File renamed without changes.

pkg/controller/hawtiotest/openshift/testdata/crds/clusterversions.config.openshift.io.yaml renamed to pkg/controller/internal/hawtiotest/openshift/testdata/crds/clusterversions.config.openshift.io.yaml

File renamed without changes.

0 commit comments

Comments
 (0)