1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/pkg/engine/api/resourcespec_test.go
Charles-Edouard Brétéché 892b8f921d
refactor: clean engine api package (#6156)
* 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>
2023-01-30 14:49:44 +00:00

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)
}
})
}
}