mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-21 10:57:01 +00:00
fix tests
This commit is contained in:
parent
bebab866e6
commit
7c6bf57296
2 changed files with 8 additions and 8 deletions
|
|
@ -100,7 +100,7 @@ func TestDownloadSchema(t *testing.T) {
|
||||||
strict: testCase.strict,
|
strict: testCase.strict,
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := reg.DownloadSchema(testCase.resourceKind, testCase.resourceAPIVersion, testCase.k8sversion)
|
_, res, err := reg.DownloadSchema(testCase.resourceKind, testCase.resourceAPIVersion, testCase.k8sversion)
|
||||||
if err == nil || testCase.expectErr == nil {
|
if err == nil || testCase.expectErr == nil {
|
||||||
if err != testCase.expectErr {
|
if err != testCase.expectErr {
|
||||||
t.Errorf("during test '%s': expected error, got:\n%s\n%s\n", testCase.name, testCase.expectErr, err)
|
t.Errorf("during test '%s': expected error, got:\n%s\n%s\n", testCase.name, testCase.expectErr, err)
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,16 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockRegistry struct {
|
type mockRegistry struct {
|
||||||
SchemaDownloader func() ([]byte, error)
|
SchemaDownloader func() (string, []byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMockRegistry(f func() ([]byte, error)) *mockRegistry {
|
func newMockRegistry(f func() (string, []byte, error)) *mockRegistry {
|
||||||
return &mockRegistry{
|
return &mockRegistry{
|
||||||
SchemaDownloader: f,
|
SchemaDownloader: f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m mockRegistry) DownloadSchema(resourceKind, resourceAPIVersion, k8sVersion string) ([]byte, error) {
|
func (m mockRegistry) DownloadSchema(resourceKind, resourceAPIVersion, k8sVersion string) (string, []byte, error) {
|
||||||
return m.SchemaDownloader()
|
return m.SchemaDownloader()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -362,11 +362,11 @@ lastName: bar
|
||||||
schemaCache: nil,
|
schemaCache: nil,
|
||||||
schemaDownload: downloadSchema,
|
schemaDownload: downloadSchema,
|
||||||
regs: []registry.Registry{
|
regs: []registry.Registry{
|
||||||
newMockRegistry(func() ([]byte, error) {
|
newMockRegistry(func() (string, []byte, error) {
|
||||||
return testCase.schemaRegistry1, nil
|
return "", testCase.schemaRegistry1, nil
|
||||||
}),
|
}),
|
||||||
newMockRegistry(func() ([]byte, error) {
|
newMockRegistry(func() (string, []byte, error) {
|
||||||
return testCase.schemaRegistry2, nil
|
return "", testCase.schemaRegistry2, nil
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue