mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-23 09:18:26 +00:00
parent
9c8ab50d60
commit
9d0824beb6
3 changed files with 9 additions and 1 deletions
|
|
@ -47,6 +47,7 @@ func TestAutoSyncSelfHealEnabled(t *testing.T) {
|
|||
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{SelfHeal: true}}
|
||||
}).
|
||||
Then().
|
||||
Expect(OperationPhaseIs(OperationSucceeded)).
|
||||
Expect(SyncStatusIs(SyncStatusCodeSynced)).
|
||||
When().
|
||||
// app should be auto-synced once k8s change detected
|
||||
|
|
@ -55,12 +56,14 @@ func TestAutoSyncSelfHealEnabled(t *testing.T) {
|
|||
"guestbook-ui", types.MergePatchType, []byte(`{"spec": {"revisionHistoryLimit": 0}}`)))
|
||||
}).
|
||||
Then().
|
||||
Expect(OperationPhaseIs(OperationSucceeded)).
|
||||
Expect(SyncStatusIs(SyncStatusCodeSynced)).
|
||||
When().
|
||||
// app should be attempted to auto-synced once and marked with error after failed attempt detected
|
||||
PatchFile("guestbook-ui-deployment.yaml", `[{"op": "replace", "path": "/spec/revisionHistoryLimit", "value": "badValue"}]`).
|
||||
Refresh(RefreshTypeNormal).
|
||||
Then().
|
||||
Expect(OperationPhaseIs(OperationFailed)).
|
||||
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
|
||||
Expect(Condition(ApplicationConditionSyncError, "Failed sync attempt"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ type Context struct {
|
|||
|
||||
func Given(t *testing.T) *Context {
|
||||
fixture.EnsureCleanState(t)
|
||||
return &Context{t: t, destServer: KubernetesInternalAPIServerAddr, repoURLType: fixture.RepoURLTypeFile, name: fixture.Name(), timeout: 5, project: "default", prune: true}
|
||||
return &Context{t: t, destServer: KubernetesInternalAPIServerAddr, repoURLType: fixture.RepoURLTypeFile, name: fixture.Name(), timeout: 10, project: "default", prune: true}
|
||||
}
|
||||
|
||||
func (c *Context) CustomCACertAdded() *Context {
|
||||
|
|
|
|||
|
|
@ -274,6 +274,8 @@ func TestHookDeleteBeforeCreation(t *testing.T) {
|
|||
Sync().
|
||||
Then().
|
||||
Expect(OperationPhaseIs(OperationSucceeded)).
|
||||
Expect(SyncStatusIs(SyncStatusCodeSynced)).
|
||||
Expect(HealthIs(HealthStatusHealthy)).
|
||||
And(func(_ *Application) {
|
||||
var err error
|
||||
creationTimestamp1, err = getCreationTimestamp()
|
||||
|
|
@ -286,6 +288,8 @@ func TestHookDeleteBeforeCreation(t *testing.T) {
|
|||
Sync().
|
||||
Then().
|
||||
Expect(OperationPhaseIs(OperationSucceeded)).
|
||||
Expect(SyncStatusIs(SyncStatusCodeSynced)).
|
||||
Expect(HealthIs(HealthStatusHealthy)).
|
||||
And(func(_ *Application) {
|
||||
creationTimestamp2, err := getCreationTimestamp()
|
||||
CheckError(err)
|
||||
|
|
@ -295,6 +299,7 @@ func TestHookDeleteBeforeCreation(t *testing.T) {
|
|||
}
|
||||
|
||||
func getCreationTimestamp() (string, error) {
|
||||
FailOnErr(Run(".", "kubectl", "-n", DeploymentNamespace(), "get", "all"))
|
||||
return Run(".", "kubectl", "-n", DeploymentNamespace(), "get", "pod", "hook", "-o", "jsonpath={.metadata.creationTimestamp}")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue