github.com/argoproj/argo-cd@v1.8.7/test/e2e/app_deletion_test.go (about)

     1  package e2e
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/argoproj/gitops-engine/pkg/sync/common"
     7  
     8  	. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
     9  	. "github.com/argoproj/argo-cd/test/e2e/fixture"
    10  	. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
    11  )
    12  
    13  // when a app gets stuck in sync, and we try to delete it, it won't delete, instead we must then terminate it
    14  // and deletion will then just happen
    15  func TestDeletingAppStuckInSync(t *testing.T) {
    16  	Given(t).
    17  		And(func() {
    18  			SetResourceOverrides(map[string]ResourceOverride{
    19  				"ConfigMap": {
    20  					HealthLua: `return { status = obj.annotations and obj.annotations['health'] or 'Progressing' }`,
    21  				},
    22  			})
    23  		}).
    24  		Async(true).
    25  		Path("hook-custom-health").
    26  		When().
    27  		Create().
    28  		Sync().
    29  		Then().
    30  		// stuck in running state
    31  		Expect(OperationPhaseIs(OperationRunning)).
    32  		Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
    33  		When().
    34  		Delete(true).
    35  		Then().
    36  		// delete is ignored, still stuck in running state
    37  		Expect(OperationPhaseIs(OperationRunning)).
    38  		When().
    39  		TerminateOp().
    40  		Then().
    41  		// delete is successful
    42  		Expect(DoesNotExist())
    43  }