Skip to content

Commit 41932d4

Browse files
committed
resolve linter
Signed-off-by: Atif Ali <atali@redhat.com>
1 parent 08456c8 commit 41932d4

1 file changed

Lines changed: 4 additions & 22 deletions

File tree

test/e2e/git_test.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import (
1111
"k8s.io/apimachinery/pkg/types"
1212
"k8s.io/apimachinery/pkg/util/wait"
1313

14+
"github.com/stretchr/testify/require"
15+
1416
. "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
1517
"github.com/argoproj/argo-cd/v3/test/e2e/fixture"
1618
. "github.com/argoproj/argo-cd/v3/test/e2e/fixture/app"
1719
"github.com/argoproj/argo-cd/v3/util/errors"
18-
"github.com/stretchr/testify/require"
1920
)
2021

2122
func TestGitSemverResolutionNotUsingConstraint(t *testing.T) {
@@ -104,22 +105,21 @@ func TestAnnotatedTagInStatusSyncRevision(t *testing.T) {
104105
When().
105106
// Create annotated tag name 'annotated-tag'
106107
AddAnnotatedTag("annotated-tag", "my-generic-tag-message").
107-
// Create Application targetting annotated-tag, with automatedSync: true
108+
// Create Application targeting annotated-tag, with automatedSync: true
108109
CreateFromFile(func(app *Application) {
109110
app.Spec.Source.TargetRevision = "annotated-tag"
110111
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{Prune: true, SelfHeal: false}}
111112
}).
112113
Then().
113114
Expect(SyncStatusIs(SyncStatusCodeSynced)).
114115
And(func(app *Application) {
115-
116116
annotatedTagIDOutput, err := fixture.Run(fixture.TmpDir+"/testdata.git", "git", "show-ref", "annotated-tag")
117117
require.NoError(t, err)
118118
require.NotEmpty(t, annotatedTagIDOutput)
119119
// example command output:
120120
// "569798c430515ffe170bdb23e3aafaf8ae24b9ff refs/tags/annotated-tag"
121121
annotatedTagIDFields := strings.Fields(string(annotatedTagIDOutput))
122-
require.Equal(t, len(annotatedTagIDFields), 2)
122+
require.Len(t, annotatedTagIDFields, 2)
123123

124124
targetCommitID, err := fixture.Run(fixture.TmpDir+"/testdata.git", "git", "rev-parse", "--verify", "annotated-tag^{commit}")
125125
// example command output:
@@ -136,7 +136,6 @@ func TestAnnotatedTagInStatusSyncRevision(t *testing.T) {
136136

137137
// Test updates to K8s resources should not trigger a self-heal when self-heal is false.
138138
func TestAutomatedSelfHealingAgainstAnnotatedTag(t *testing.T) {
139-
140139
Given(t).
141140
Path(guestbookPath).
142141
When().
@@ -156,19 +155,15 @@ func TestAutomatedSelfHealingAgainstAnnotatedTag(t *testing.T) {
156155
Refresh(RefreshTypeHard).
157156
// The Application should update to the new annotated tag value within 10 seconds.
158157
And(func() {
159-
160158
// Deployment revisionHistoryLimit should switch to 10
161159
timeoutErr := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (done bool, err error) {
162-
163160
deployment, err := fixture.KubeClientset.AppsV1().Deployments(fixture.DeploymentNamespace()).Get(context.Background(), "guestbook-ui", metav1.GetOptions{})
164-
165161
if err != nil {
166162
return false, nil
167163
}
168164

169165
revisionHistoryLimit := deployment.Spec.RevisionHistoryLimit
170166
return revisionHistoryLimit != nil && *revisionHistoryLimit == 10, nil
171-
172167
})
173168
require.NoError(t, timeoutErr)
174169
}).
@@ -179,26 +174,21 @@ func TestAutomatedSelfHealingAgainstAnnotatedTag(t *testing.T) {
179174
}).
180175
// The revisionHistoryLimit should NOT be self-healed, because selfHealing: false. It should remain at 9.
181176
And(func() {
182-
183177
// Wait up to 10 seconds to ensure that deployment revisionHistoryLimit does NOT should switch to 10, it should remain at 9.
184178
waitErr := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (done bool, err error) {
185-
186179
deployment, err := fixture.KubeClientset.AppsV1().Deployments(fixture.DeploymentNamespace()).Get(context.Background(), "guestbook-ui", metav1.GetOptions{})
187-
188180
if err != nil {
189181
return false, nil
190182
}
191183

192184
revisionHistoryLimit := deployment.Spec.RevisionHistoryLimit
193185
return revisionHistoryLimit != nil && *revisionHistoryLimit != 9, nil
194-
195186
})
196187
require.Error(t, waitErr, "A timeout error should occur, indicating that revisionHistoryLimit never changed from 9")
197188
})
198189
}
199190

200191
func TestAutomatedSelfHealingAgainstLightweightTag(t *testing.T) {
201-
202192
Given(t).
203193
Path(guestbookPath).
204194
When().
@@ -218,19 +208,15 @@ func TestAutomatedSelfHealingAgainstLightweightTag(t *testing.T) {
218208
Refresh(RefreshTypeHard).
219209
// The Application should update to the new annotated tag value within 10 seconds.
220210
And(func() {
221-
222211
// Deployment revisionHistoryLimit should switch to 10
223212
timeoutErr := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (done bool, err error) {
224-
225213
deployment, err := fixture.KubeClientset.AppsV1().Deployments(fixture.DeploymentNamespace()).Get(context.Background(), "guestbook-ui", metav1.GetOptions{})
226-
227214
if err != nil {
228215
return false, nil
229216
}
230217

231218
revisionHistoryLimit := deployment.Spec.RevisionHistoryLimit
232219
return revisionHistoryLimit != nil && *revisionHistoryLimit == 10, nil
233-
234220
})
235221
require.NoError(t, timeoutErr)
236222
}).
@@ -241,19 +227,15 @@ func TestAutomatedSelfHealingAgainstLightweightTag(t *testing.T) {
241227
}).
242228
// The revisionHistoryLimit should NOT be self-healed, because selfHealing: false
243229
And(func() {
244-
245230
// Wait up to 10 seconds to ensure that deployment revisionHistoryLimit does NOT should switch to 10, it should remain at 9.
246231
waitErr := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (done bool, err error) {
247-
248232
deployment, err := fixture.KubeClientset.AppsV1().Deployments(fixture.DeploymentNamespace()).Get(context.Background(), "guestbook-ui", metav1.GetOptions{})
249-
250233
if err != nil {
251234
return false, nil
252235
}
253236

254237
revisionHistoryLimit := deployment.Spec.RevisionHistoryLimit
255238
return revisionHistoryLimit != nil && *revisionHistoryLimit != 9, nil
256-
257239
})
258240
require.Error(t, waitErr, "A timeout error should occur, indicating that revisionHistoryLimit never changed from 9")
259241
})

0 commit comments

Comments
 (0)