1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 23:46:56 +00:00
kyverno/cmd/cli/kubectl-kyverno/test/test_case_test.go
Charles-Edouard Brétéché a43a20adb9
feat: add cli api schemas (#8422)
* feat: add cli values schema

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* docs

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* makefile

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* v1alpha1

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* codegen

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* nits

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-09-17 23:50:17 +03:00

45 lines
788 B
Go

package test
import (
"testing"
"github.com/go-git/go-billy/v5"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/apis/v1alpha1"
)
func TestTestCase_Dir(t *testing.T) {
type fields struct {
}
tests := []struct {
name string
Path string
Fs billy.Filesystem
Test *v1alpha1.Test
Err error
want string
}{{
name: "empty",
want: ".",
}, {
name: "relative",
Path: "foo/bar/baz.yaml",
want: "foo/bar",
}, {
name: "absolute",
Path: "/foo/bar/baz.yaml",
want: "/foo/bar",
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tc := TestCase{
Path: tt.Path,
Fs: tt.Fs,
Test: tt.Test,
Err: tt.Err,
}
if got := tc.Dir(); got != tt.want {
t.Errorf("TestCase.Dir() = %v, want %v", got, tt.want)
}
})
}
}