mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
26 lines
835 B
Go
26 lines
835 B
Go
package ignore
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
|
|
"github.com/argoproj/argo-cd/gitops-engine/pkg/sync/common"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
testingutils "github.com/argoproj/argo-cd/gitops-engine/pkg/utils/testing"
|
|
)
|
|
|
|
func newHook(obj *unstructured.Unstructured, hookType common.HookType) *unstructured.Unstructured {
|
|
return testingutils.Annotate(obj, "argocd.argoproj.io/hook", string(hookType))
|
|
}
|
|
|
|
func TestIgnore(t *testing.T) {
|
|
assert.False(t, Ignore(testingutils.NewPod()))
|
|
assert.False(t, Ignore(newHook(testingutils.NewPod(), "Sync")))
|
|
assert.True(t, Ignore(newHook(testingutils.NewPod(), "garbage")))
|
|
assert.False(t, Ignore(testingutils.HelmHook(testingutils.NewPod(), "pre-install")))
|
|
assert.True(t, Ignore(testingutils.HelmHook(testingutils.NewPod(), "garbage")))
|
|
}
|