mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-12 03:48:28 +00:00
25 lines
575 B
Go
25 lines
575 B
Go
package cache
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsParentOf(t *testing.T) {
|
|
child := createObjInfo(testPod, "")
|
|
parent := createObjInfo(testRS, "")
|
|
grandParent := createObjInfo(testDeploy, "")
|
|
|
|
assert.True(t, parent.isParentOf(child))
|
|
assert.False(t, grandParent.isParentOf(child))
|
|
}
|
|
|
|
func TestIsParentOfSameKindDifferentGroup(t *testing.T) {
|
|
rs := testRS.DeepCopy()
|
|
rs.SetAPIVersion("somecrd.io/v1")
|
|
child := createObjInfo(testPod, "")
|
|
invalidParent := createObjInfo(rs, "")
|
|
|
|
assert.False(t, invalidParent.isParentOf(child))
|
|
}
|