mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-02-14 09:59:57 +00:00
* fix(controller): decode old object for delete requests Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: modernize golang Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: modernize golang Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: modernize golang Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * fix(config): remove usergroups default Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * fix(config): remove usergroups default Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * sec(ghsa-2ww6-hf35-mfjm): intercept namespace subresource Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(api): add rulestatus api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: conflicts Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(api): add rulestatus api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(api): add rulestatus api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(api): add rulestatus api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(api): add rulestatus api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(api): add rulestatus api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * feat(api): add rulestatus api Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> --------- Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
87 lines
1.9 KiB
Go
87 lines
1.9 KiB
Go
// Copyright 2020-2026 Project Capsule Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package v1beta1
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestOwnerListSpec_FindOwner(t *testing.T) {
|
|
bla := OwnerSpec{
|
|
Kind: UserOwner,
|
|
Name: "bla",
|
|
ProxyOperations: []ProxySettings{
|
|
{
|
|
Kind: IngressClassesProxy,
|
|
Operations: []ProxyOperation{"Delete"},
|
|
},
|
|
},
|
|
}
|
|
bar := OwnerSpec{
|
|
Kind: GroupOwner,
|
|
Name: "bar",
|
|
ProxyOperations: []ProxySettings{
|
|
{
|
|
Kind: StorageClassesProxy,
|
|
Operations: []ProxyOperation{"Delete"},
|
|
},
|
|
},
|
|
}
|
|
baz := OwnerSpec{
|
|
Kind: UserOwner,
|
|
Name: "baz",
|
|
ProxyOperations: []ProxySettings{
|
|
{
|
|
Kind: StorageClassesProxy,
|
|
Operations: []ProxyOperation{"Update"},
|
|
},
|
|
},
|
|
}
|
|
fim := OwnerSpec{
|
|
Kind: ServiceAccountOwner,
|
|
Name: "fim",
|
|
ProxyOperations: []ProxySettings{
|
|
{
|
|
Kind: NodesProxy,
|
|
Operations: []ProxyOperation{"List"},
|
|
},
|
|
},
|
|
}
|
|
bom := OwnerSpec{
|
|
Kind: GroupOwner,
|
|
Name: "bom",
|
|
ProxyOperations: []ProxySettings{
|
|
{
|
|
Kind: StorageClassesProxy,
|
|
Operations: []ProxyOperation{"Delete"},
|
|
},
|
|
{
|
|
Kind: NodesProxy,
|
|
Operations: []ProxyOperation{"Delete"},
|
|
},
|
|
},
|
|
}
|
|
qip := OwnerSpec{
|
|
Kind: ServiceAccountOwner,
|
|
Name: "qip",
|
|
ProxyOperations: []ProxySettings{
|
|
{
|
|
Kind: StorageClassesProxy,
|
|
Operations: []ProxyOperation{"List", "Delete"},
|
|
},
|
|
},
|
|
}
|
|
owners := OwnerListSpec{bom, qip, bla, bar, baz, fim}
|
|
|
|
assert.Equal(t, owners.FindOwner("bom", GroupOwner), bom)
|
|
assert.Equal(t, owners.FindOwner("qip", ServiceAccountOwner), qip)
|
|
assert.Equal(t, owners.FindOwner("bla", UserOwner), bla)
|
|
assert.Equal(t, owners.FindOwner("bar", GroupOwner), bar)
|
|
assert.Equal(t, owners.FindOwner("baz", UserOwner), baz)
|
|
assert.Equal(t, owners.FindOwner("fim", ServiceAccountOwner), fim)
|
|
assert.Equal(t, owners.FindOwner("notfound", ServiceAccountOwner), OwnerSpec{})
|
|
}
|