Skip to content

Commit

Permalink
feat: option to disable writing k8s events
Browse files Browse the repository at this point in the history
fix unit test
- application_test
- applicationset_test
- project_test
- appcontroller_tes
- audit_logger_test

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
  • Loading branch information
Jack-R-lantern committed Sep 9, 2024
1 parent 5ac6ef5 commit f12fbe9
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 49 deletions.
4 changes: 2 additions & 2 deletions controller/appcontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import (
"github.com/argoproj/argo-cd/v2/util/settings"
)

var testEnableEventLog map[string](bool) = argo.TestEnableEventLog()
var testEnableEventList []string = argo.DefaultEnableEventList()

type namespacedResource struct {
v1alpha1.ResourceNode
Expand Down Expand Up @@ -167,7 +167,7 @@ func newFakeController(data *fakeData, repoErr error) *ApplicationController {
false,
false,
normalizers.IgnoreNormalizerOpts{},
testEnableEventLog,
testEnableEventList,
)
db := &dbmocks.ArgoDB{}
db.On("GetApplicationControllerReplicas").Return(1)
Expand Down
6 changes: 4 additions & 2 deletions server/application/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ const (
fakeRepoURL = "https://git.com/repo.git"
)

var testEnableEventList []string = argo.DefaultEnableEventList()

func fakeRepo() *appsv1.Repository {
return &appsv1.Repository{
Repo: fakeRepoURL,
Expand Down Expand Up @@ -306,7 +308,7 @@ func newTestAppServerWithEnforcerConfigure(f func(*rbac.Enforcer), t *testing.T,
settingsMgr,
projInformer,
[]string{},
argo.TestEnableEventLog(),
testEnableEventList,
)
return server.(*Server)
}
Expand Down Expand Up @@ -487,7 +489,7 @@ func newTestAppServerWithEnforcerConfigureWithBenchmark(f func(*rbac.Enforcer),
settingsMgr,
projInformer,
[]string{},
argo.TestEnableEventLog(),
testEnableEventList,
)
return server.(*Server)
}
Expand Down
5 changes: 4 additions & 1 deletion server/applicationset/applicationset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
apps "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned/fake"
appinformer "github.com/argoproj/argo-cd/v2/pkg/client/informers/externalversions"
"github.com/argoproj/argo-cd/v2/server/rbacpolicy"
"github.com/argoproj/argo-cd/v2/util/argo"
"github.com/argoproj/argo-cd/v2/util/assets"
"github.com/argoproj/argo-cd/v2/util/db"
"github.com/argoproj/argo-cd/v2/util/errors"
Expand All @@ -34,6 +35,8 @@ const (
fakeRepoURL = "https://git.com/repo.git"
)

var testEnableEventList []string = argo.DefaultEnableEventList()

func fakeRepo() *appsv1.Repository {
return &appsv1.Repository{
Repo: fakeRepoURL,
Expand Down Expand Up @@ -162,7 +165,7 @@ func newTestAppSetServerWithEnforcerConfigure(f func(*rbac.Enforcer), namespace
"",
[]string{},
true,
argo.TestEnableEventLog(),
testEnableEventList,
)
return server.(*Server)
}
Expand Down
Loading

0 comments on commit f12fbe9

Please sign in to comment.