Skip to content

Commit

Permalink
Fix flaky TestOrphanedResource test (argoproj#2210)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Matyushentsev authored Aug 23, 2019
1 parent 8b29b9c commit 608361c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/e2e/app_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,7 @@ func TestOrphanedResource(t *testing.T) {
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
assert.Len(t, app.Status.Conditions, 0)
}).
Expect(NoConditions()).
When().
And(func() {
errors.FailOnErr(fixture.KubeClientset.CoreV1().ConfigMaps(fixture.DeploymentNamespace()).Create(&v1.ConfigMap{
Expand All @@ -824,7 +822,5 @@ func TestOrphanedResource(t *testing.T) {
Refresh(RefreshTypeNormal).
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
assert.Len(t, app.Status.Conditions, 0)
})
Expect(NoConditions())
}
10 changes: 10 additions & 0 deletions test/e2e/fixture/app/expectation.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ func Condition(conditionType ApplicationConditionType, conditionMessage string)
}
}

func NoConditions() Expectation {
return func(c *Consequences) (state, string) {
message := "no conditions"
if len(c.app().Status.Conditions) == 0 {
return succeeded, message
}
return pending, message
}
}

func HealthIs(expected HealthStatusCode) Expectation {
return func(c *Consequences) (state, string) {
actual := c.app().Status.Health.Status
Expand Down

0 comments on commit 608361c

Please sign in to comment.