generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into 66-eventing-default…
…ing-values
- Loading branch information
Showing
23 changed files
with
319 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
internal/controller/eventing/integrationtests/without_apirule_crd/integration_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package controller_switching | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
eventingv1alpha1 "github.com/kyma-project/eventing-manager/api/v1alpha1" | ||
"github.com/kyma-project/eventing-manager/test/matchers" | ||
"github.com/kyma-project/eventing-manager/test/utils" | ||
testutils "github.com/kyma-project/eventing-manager/test/utils/integration" | ||
"github.com/onsi/gomega" | ||
gomegatypes "github.com/onsi/gomega/types" | ||
) | ||
|
||
const ( | ||
projectRootDir = "../../../../../" | ||
) | ||
|
||
var testEnvironment *testutils.TestEnvironment //nolint:gochecknoglobals // used in tests | ||
|
||
// TestMain pre-hook and post-hook to run before and after all tests. | ||
func TestMain(m *testing.M) { | ||
// Note: The setup will provision a single K8s env and | ||
// all the tests need to create and use a separate namespace | ||
|
||
// setup env test | ||
var err error | ||
testEnvironment, err = testutils.NewTestEnvironment(testutils.TestEnvironmentConfig{ | ||
ProjectRootDir: projectRootDir, | ||
CELValidationEnabled: true, | ||
APIRuleCRDEnabled: false, | ||
ApplicationRuleCRDEnabled: true, | ||
NATSCRDEnabled: true, | ||
AllowedEventingCR: nil, | ||
}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// run tests | ||
code := m.Run() | ||
|
||
// tear down test env | ||
if err = testEnvironment.TearDown(); err != nil { | ||
panic(err) | ||
} | ||
|
||
os.Exit(code) | ||
} | ||
|
||
// Test_EventMesh_APIRule_Dependency_Check tests that when the APIRule CRD is missing in case of EventMesh, | ||
// the Eventing CR should have Error status with a message. The success case where APIRule exists is | ||
// covered in integrationtests/controller/integration_test.go. | ||
func Test_EventMesh_APIRule_Dependency_Check(t *testing.T) { | ||
t.Parallel() | ||
|
||
testCases := []struct { | ||
name string | ||
givenEventing *eventingv1alpha1.Eventing | ||
wantMatches gomegatypes.GomegaMatcher | ||
}{ | ||
{ | ||
name: "Eventing CR should error state due to APIRule CRD not available", | ||
givenEventing: utils.NewEventingCR( | ||
utils.WithEventMeshBackend("test-secret-name1"), | ||
utils.WithEventingPublisherData(1, 1, "199m", "99Mi", "399m", "199Mi"), | ||
utils.WithEventingEventTypePrefix("test-prefix"), | ||
utils.WithEventingDomain(utils.Domain), | ||
), | ||
wantMatches: gomega.And( | ||
matchers.HaveStatusError(), | ||
matchers.HaveEventMeshSubManagerNotReadyCondition( | ||
"API-Gateway module is needed for EventMesh backend. APIRules CRD is not installed"), | ||
), | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
tc := tc | ||
t.Run(tc.name, func(t *testing.T) { | ||
g := gomega.NewWithT(t) | ||
|
||
// given | ||
// create unique namespace for this test run. | ||
givenNamespace := tc.givenEventing.Namespace | ||
testEnvironment.EnsureNamespaceCreation(t, givenNamespace) | ||
|
||
// create eventing-webhook-auth secret. | ||
testEnvironment.EnsureOAuthSecretCreated(t, tc.givenEventing) | ||
|
||
// create EventMesh secret. | ||
testEnvironment.EnsureEventMeshSecretCreated(t, tc.givenEventing) | ||
|
||
// when | ||
// create Eventing CR. | ||
testEnvironment.EnsureK8sResourceCreated(t, tc.givenEventing) | ||
|
||
// then | ||
// check Eventing CR status. | ||
testEnvironment.GetEventingAssert(g, tc.givenEventing).Should(tc.wantMatches) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.