mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
892b8f921d
* refactor: introduce engine api package Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * status Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: clean engine api package Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * cleanup Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
45 lines
883 B
Go
45 lines
883 B
Go
package api
|
|
|
|
import "testing"
|
|
|
|
func TestResourceSpec_GetKey(t *testing.T) {
|
|
type fields struct {
|
|
Kind string
|
|
APIVersion string
|
|
Namespace string
|
|
Name string
|
|
UID string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
want string
|
|
}{{
|
|
fields: fields{
|
|
Kind: "Pod",
|
|
Namespace: "test",
|
|
Name: "nignx",
|
|
},
|
|
want: "Pod/test/nignx",
|
|
}, {
|
|
fields: fields{
|
|
Kind: "ClusterRole",
|
|
Name: "admin",
|
|
},
|
|
want: "ClusterRole//admin",
|
|
}}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
rs := ResourceSpec{
|
|
Kind: tt.fields.Kind,
|
|
APIVersion: tt.fields.APIVersion,
|
|
Namespace: tt.fields.Namespace,
|
|
Name: tt.fields.Name,
|
|
UID: tt.fields.UID,
|
|
}
|
|
if got := rs.String(); got != tt.want {
|
|
t.Errorf("ResourceSpec.GetKey() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|