Skip to content

Commit 418e5fc

Browse files
committed
fix func names
1 parent 16bc588 commit 418e5fc

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

pkg/app_watcher/app_watcher_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ func TestApplicationUpdated(t *testing.T) {
8686
assert.Equal(t, len(ctrl.vcsToArgoMap.GetMap()), 2)
8787

8888
oldAppDirectory := ctrl.vcsToArgoMap.GetAppsInRepo("https://gitlab.com/test/repo.git")
89+
assert.Equal(t, oldAppDirectory.AppsCount(), 1)
90+
8991
newAppDirectory := ctrl.vcsToArgoMap.GetAppsInRepo("https://gitlab.com/test/repo-3.git")
90-
assert.Equal(t, oldAppDirectory.Count(), 1)
91-
assert.Equal(t, newAppDirectory.Count(), 0)
92+
assert.Equal(t, newAppDirectory.AppsCount(), 0)
9293
//
9394
_, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications("default").Update(ctx, &v1alpha1.Application{
9495
ObjectMeta: metav1.ObjectMeta{Name: "test-app-1", Namespace: "default"},
@@ -102,8 +103,8 @@ func TestApplicationUpdated(t *testing.T) {
102103
time.Sleep(time.Second * 1)
103104
oldAppDirectory = ctrl.vcsToArgoMap.GetAppsInRepo("https://gitlab.com/test/repo.git")
104105
newAppDirectory = ctrl.vcsToArgoMap.GetAppsInRepo("https://gitlab.com/test/repo-3.git")
105-
assert.Equal(t, oldAppDirectory.Count(), 0)
106-
assert.Equal(t, newAppDirectory.Count(), 1)
106+
assert.Equal(t, oldAppDirectory.AppsCount(), 0)
107+
assert.Equal(t, newAppDirectory.AppsCount(), 1)
107108
}
108109

109110
func TestApplicationDeleted(t *testing.T) {
@@ -119,7 +120,7 @@ func TestApplicationDeleted(t *testing.T) {
119120
assert.Equal(t, len(ctrl.vcsToArgoMap.GetMap()), 2)
120121

121122
appDirectory := ctrl.vcsToArgoMap.GetAppsInRepo("https://gitlab.com/test/repo.git")
122-
assert.Equal(t, appDirectory.Count(), 1)
123+
assert.Equal(t, appDirectory.AppsCount(), 1)
123124
//
124125
err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications("default").Delete(ctx, "test-app-1", metav1.DeleteOptions{})
125126
if err != nil {
@@ -128,7 +129,7 @@ func TestApplicationDeleted(t *testing.T) {
128129
time.Sleep(time.Second * 1)
129130

130131
appDirectory = ctrl.vcsToArgoMap.GetAppsInRepo("https://gitlab.com/test/repo.git")
131-
assert.Equal(t, appDirectory.Count(), 0)
132+
assert.Equal(t, appDirectory.AppsCount(), 0)
132133
}
133134

134135
// TestIsGitRepo will test various URLs against the isGitRepo function.

pkg/appdir/vcstoargomap_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestAddApp(t *testing.T) {
2626
v2a.AddApp(app1)
2727
appDir := v2a.GetAppsInRepo("https://github.com/argoproj/argo-cd.git")
2828

29-
assert.Equal(t, appDir.Count(), 1)
29+
assert.Equal(t, appDir.AppsCount(), 1)
3030
assert.Equal(t, len(appDir.appDirs["test-app-1"]), 1)
3131

3232
// Assertions to verify the behavior here.
@@ -41,7 +41,7 @@ func TestAddApp(t *testing.T) {
4141
}
4242

4343
v2a.AddApp(app2)
44-
assert.Equal(t, appDir.Count(), 2)
44+
assert.Equal(t, appDir.AppsCount(), 2)
4545
assert.Equal(t, len(appDir.appDirs["test-app-2"]), 1)
4646
}
4747

@@ -73,27 +73,26 @@ func TestDeleteApp(t *testing.T) {
7373
v2a.AddApp(app2)
7474
appDir := v2a.GetAppsInRepo("https://github.com/argoproj/argo-cd.git")
7575

76-
assert.Equal(t, appDir.Count(), 2)
76+
assert.Equal(t, appDir.AppsCount(), 2)
7777
assert.Equal(t, len(appDir.appDirs["test-app-1"]), 1)
7878
assert.Equal(t, len(appDir.appDirs["test-app-2"]), 1)
7979

8080
v2a.DeleteApp(app2)
81-
assert.Equal(t, appDir.Count(), 1)
81+
assert.Equal(t, appDir.AppsCount(), 1)
8282
assert.Equal(t, len(appDir.appDirs["test-app-2"]), 0)
8383
}
8484

8585
func TestVcsToArgoMap_AddAppSet(t *testing.T) {
8686
type args struct {
8787
app *v1alpha1.ApplicationSet
8888
}
89-
tests := []struct {
89+
tests := map[string]struct {
9090
name string
9191
fields VcsToArgoMap
9292
args args
9393
expectedCount int
9494
}{
95-
{
96-
name: "normal process, expect to get the appset stored in the map",
95+
"normal process, expect to get the appset stored in the map": {
9796
fields: NewVcsToArgoMap("dummyuser"),
9897
args: args{
9998
app: &v1alpha1.ApplicationSet{
@@ -112,8 +111,7 @@ func TestVcsToArgoMap_AddAppSet(t *testing.T) {
112111
},
113112
expectedCount: 1,
114113
},
115-
{
116-
name: "invalid appset",
114+
"invalid appset": {
117115
fields: NewVcsToArgoMap("vcs-username"),
118116
args: args{
119117
app: &v1alpha1.ApplicationSet{

0 commit comments

Comments
 (0)