mirror of
https://github.com/yannh/kubeconform.git
synced 2026-04-14 00:14:45 +00:00
Update Junit tests, fix #45
This commit is contained in:
parent
1b01a42488
commit
2eefa7fc22
5 changed files with 72 additions and 141 deletions
|
|
@ -1,13 +1,12 @@
|
|||
package validator
|
||||
|
||||
import (
|
||||
"github.com/yannh/kubeconform/pkg/registry"
|
||||
"testing"
|
||||
"github.com/yannh/kubeconform/pkg/registry"
|
||||
"testing"
|
||||
|
||||
"github.com/yannh/kubeconform/pkg/resource"
|
||||
"github.com/yannh/kubeconform/pkg/resource"
|
||||
)
|
||||
|
||||
|
||||
type mockRegistry struct {
|
||||
SchemaDownloader func() ([]byte, error)
|
||||
}
|
||||
|
|
@ -22,14 +21,13 @@ func (m mockRegistry) DownloadSchema(resourceKind, resourceAPIVersion, k8sVersio
|
|||
return m.SchemaDownloader()
|
||||
}
|
||||
|
||||
|
||||
func TestValidate(t *testing.T) {
|
||||
for i, testCase := range []struct {
|
||||
name string
|
||||
rawResource, schemaRegistry1 []byte
|
||||
schemaRegistry2 []byte
|
||||
ignoreMissingSchema bool
|
||||
expect Status
|
||||
name string
|
||||
rawResource, schemaRegistry1 []byte
|
||||
schemaRegistry2 []byte
|
||||
ignoreMissingSchema bool
|
||||
expect Status
|
||||
}{
|
||||
{
|
||||
"valid resource",
|
||||
|
|
@ -292,11 +290,11 @@ lastName: bar
|
|||
} {
|
||||
val := v{
|
||||
opts: Opts{
|
||||
SkipKinds: map[string]struct{}{},
|
||||
RejectKinds: map[string]struct{}{},
|
||||
SkipKinds: map[string]struct{}{},
|
||||
RejectKinds: map[string]struct{}{},
|
||||
IgnoreMissingSchemas: testCase.ignoreMissingSchema,
|
||||
},
|
||||
schemaCache: nil,
|
||||
schemaCache: nil,
|
||||
schemaDownload: downloadSchema,
|
||||
regs: []registry.Registry{
|
||||
newMockRegistry(func() ([]byte, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue