Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
test: make patchgenerator generic function
Browse files Browse the repository at this point in the history
  • Loading branch information
supershal committed Apr 2, 2024
1 parent 66c2656 commit 89a8bb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/handlers/aws/mutation/region/inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ func TestRegionPatch(t *testing.T) {

var _ = Describe("Generate AWS Region patches", func() {
// only add aws region patch
regionPatchGenerator := func() mutation.GeneratePatches {
patchGenerator := func() mutation.GeneratePatches {
return mutation.NewMetaGeneratePatchesHandler("", NewPatch()).(mutation.GeneratePatches)
}
regiontests.TestGeneratePatches(
GinkgoT(),
regionPatchGenerator,
patchGenerator,
clusterconfig.MetaVariableName,
v1alpha1.AWSVariableName,
VariableName,
Expand Down
6 changes: 4 additions & 2 deletions pkg/handlers/generic/mutation/httpproxy/inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ func TestHTTPProxyPatch(t *testing.T) {

var _ = Describe("Generate HTTPProxy Patches", func() {
// only add HTTPProxy patch
httpProxyPatchGenerator := func() mutation.GeneratePatches {
patchGenerator := func() mutation.GeneratePatches {
// Always initialize the testEnv variable in the closure.
// This will allow ginkgo to initialize testEnv variable during test execution time.
testEnv := helpers.TestEnv
return mutation.NewMetaGeneratePatchesHandler(
"",
NewPatch(testEnv.Client)).(mutation.GeneratePatches)
}
httpproxy.TestGeneratePatches(
GinkgoT(),
httpProxyPatchGenerator,
patchGenerator,
clusterconfig.MetaVariableName,
VariableName,
)
Expand Down

0 comments on commit 89a8bb9

Please sign in to comment.