mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-04-04 15:58:49 +02:00
* Issue #1676 - Move remove AppInstanceLabelKey, ConfigManagementPlugins, ResourceOverrides, ResourceExclusions, ResourceInclusions settings from ArgoCDSettings structure * Add missing tests
33 lines
787 B
Go
33 lines
787 B
Go
package cache
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/argoproj/argo-cd/common"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
var c = &clusterInfo{cacheSettingsSrc: func() *cacheSettings {
|
|
return &cacheSettings{AppInstanceLabelKey: common.LabelKeyAppInstance}
|
|
}}
|
|
|
|
func TestIsParentOf(t *testing.T) {
|
|
child := c.createObjInfo(testPod, "")
|
|
parent := c.createObjInfo(testRS, "")
|
|
grandParent := c.createObjInfo(testDeploy, "")
|
|
|
|
assert.True(t, parent.isParentOf(child))
|
|
assert.False(t, grandParent.isParentOf(child))
|
|
}
|
|
|
|
func TestIsParentOfSameKindDifferentGroupAndUID(t *testing.T) {
|
|
rs := testRS.DeepCopy()
|
|
rs.SetAPIVersion("somecrd.io/v1")
|
|
rs.SetUID("123")
|
|
child := c.createObjInfo(testPod, "")
|
|
invalidParent := c.createObjInfo(rs, "")
|
|
|
|
assert.False(t, invalidParent.isParentOf(child))
|
|
}
|