Skip to content

Commit

Permalink
refactor: move loader packages (#1640)
Browse files Browse the repository at this point in the history
* refactor: move loader packages

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

* fix tests

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

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly authored Jul 16, 2024
1 parent d8927c8 commit 9a9d0ec
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pkg/commands/assert/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/kyverno/chainsaw/pkg/apis/v1alpha1"
ctrlClient "github.com/kyverno/chainsaw/pkg/client"
tclient "github.com/kyverno/chainsaw/pkg/client/testing"
"github.com/kyverno/chainsaw/pkg/resource"
"github.com/kyverno/chainsaw/pkg/loaders/resource"
runnerclient "github.com/kyverno/chainsaw/pkg/runner/client"
nspacer "github.com/kyverno/chainsaw/pkg/runner/namespacer"
opassert "github.com/kyverno/chainsaw/pkg/runner/operations/assert"
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/migrate/kuttl/config/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

kuttlapi "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1"
"github.com/kyverno/chainsaw/pkg/apis/v1alpha1"
"github.com/kyverno/chainsaw/pkg/config"
"github.com/kyverno/chainsaw/pkg/resource"
"github.com/kyverno/chainsaw/pkg/loaders/config"
"github.com/kyverno/chainsaw/pkg/loaders/resource"
"github.com/kyverno/pkg/ext/resource/convert"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/migrate/kuttl/tests/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
kuttlapi "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1"
"github.com/kyverno/chainsaw/pkg/apis/v1alpha1"
"github.com/kyverno/chainsaw/pkg/discovery"
"github.com/kyverno/chainsaw/pkg/resource"
"github.com/kyverno/chainsaw/pkg/loaders/resource"
fsutils "github.com/kyverno/chainsaw/pkg/utils/fs"
"github.com/kyverno/pkg/ext/resource/convert"
"github.com/spf13/cobra"
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/test/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import (

"github.com/kyverno/chainsaw/pkg/apis/v1alpha1"
"github.com/kyverno/chainsaw/pkg/apis/v1alpha2"
"github.com/kyverno/chainsaw/pkg/config"
"github.com/kyverno/chainsaw/pkg/data"
"github.com/kyverno/chainsaw/pkg/discovery"
"github.com/kyverno/chainsaw/pkg/loaders/config"
"github.com/kyverno/chainsaw/pkg/loaders/values"
"github.com/kyverno/chainsaw/pkg/runner"
"github.com/kyverno/chainsaw/pkg/runner/failer"
"github.com/kyverno/chainsaw/pkg/runner/template"
flagutils "github.com/kyverno/chainsaw/pkg/utils/flag"
fsutils "github.com/kyverno/chainsaw/pkg/utils/fs"
restutils "github.com/kyverno/chainsaw/pkg/utils/rest"
"github.com/kyverno/chainsaw/pkg/values"
"github.com/kyverno/chainsaw/pkg/version"
"github.com/kyverno/pkg/ext/output/color"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion pkg/discovery/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/kyverno/chainsaw/pkg/apis/v1alpha1"
"github.com/kyverno/chainsaw/pkg/test"
"github.com/kyverno/chainsaw/pkg/loaders/test"
"golang.org/x/exp/maps"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions pkg/config/load_test.go → pkg/loaders/config/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ func TestLoad(t *testing.T) {
wantErr bool
}{{
name: "confimap",
path: "../../testdata/config/configmap.yaml",
path: "../../../testdata/config/configmap.yaml",
wantErr: true,
}, {
name: "not found",
path: "../../testdata/config/not-found.yaml",
path: "../../../testdata/config/not-found.yaml",
wantErr: true,
}, {
name: "empty",
path: "../../testdata/config/empty.yaml",
path: "../../../testdata/config/empty.yaml",
wantErr: true,
}, {
name: "multiple",
path: "../../testdata/config/multiple.yaml",
path: "../../../testdata/config/multiple.yaml",
wantErr: true,
}, {
name: "bad catch",
path: "../../testdata/config/v1alpha1/bad-catch.yaml",
path: "../../../testdata/config/v1alpha1/bad-catch.yaml",
wantErr: true,
}, {
name: "default",
path: "../../testdata/config/v1alpha1/default.yaml",
path: "../../../testdata/config/v1alpha1/default.yaml",
want: &v1alpha2.Configuration{
ObjectMeta: metav1.ObjectMeta{
Name: "default",
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestLoad(t *testing.T) {
},
}, {
name: "custom-config",
path: "../../testdata/config/v1alpha1/custom-config.yaml",
path: "../../../testdata/config/v1alpha1/custom-config.yaml",
want: &v1alpha2.Configuration{
ObjectMeta: metav1.ObjectMeta{
Name: "custom-config",
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestLoad(t *testing.T) {
}

func Test_parse(t *testing.T) {
content, err := os.ReadFile("../../testdata/config/v1alpha1/custom-config.yaml")
content, err := os.ReadFile("../../../testdata/config/v1alpha1/custom-config.yaml")
assert.NoError(t, err)
tests := []struct {
name string
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func TestLoad(t *testing.T) {
baseDir := filepath.Join("..", "..", "testdata", "resource")
baseDir := filepath.Join("..", "..", "..", "testdata", "resource")
tests := []struct {
fileName string
expectError bool
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestLoadFromURI(t *testing.T) {
}

func TestParse(t *testing.T) {
baseDir := filepath.Join("..", "..", "testdata", "resource")
baseDir := filepath.Join("..", "..", "..", "testdata", "resource")
tests := []struct {
fileName string
expectError bool
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestParse(t *testing.T) {
}

func Test_parse(t *testing.T) {
content, err := os.ReadFile("../../testdata/resource/custom-resource.yaml")
content, err := os.ReadFile("../../../testdata/resource/custom-resource.yaml")
assert.NoError(t, err)
tests := []struct {
name string
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pkg/test/load_test.go → pkg/loaders/test/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestLoad(t *testing.T) {
basePath := "../../testdata/test"
basePath := "../../../testdata/test"
cm := unstructured.Unstructured{}
cm.SetAPIVersion("v1")
cm.SetKind("ConfigMap")
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestLoad(t *testing.T) {
}

func Test_parse(t *testing.T) {
content, err := os.ReadFile("../../testdata/test/custom-test.yaml")
content, err := os.ReadFile("../../../testdata/test/custom-test.yaml")
assert.NoError(t, err)
tests := []struct {
name string
Expand Down Expand Up @@ -299,7 +299,7 @@ func Test_parse(t *testing.T) {
}

func Test_parse_globalErr(t *testing.T) {
content, err := os.ReadFile("../../testdata/validation/example-file.yaml")
content, err := os.ReadFile("../../../testdata/validation/example-file.yaml")
assert.NoError(t, err)
internalloader.Err = errors.New("dummy error")
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestLoad(t *testing.T) {
basePath := "../../testdata/values"
basePath := "../../../testdata/values"
tests := []struct {
name string
paths []string
Expand Down
2 changes: 1 addition & 1 deletion pkg/runner/processors/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/kyverno/chainsaw/pkg/apis/v1alpha2"
"github.com/kyverno/chainsaw/pkg/client"
"github.com/kyverno/chainsaw/pkg/discovery"
"github.com/kyverno/chainsaw/pkg/loaders/resource"
"github.com/kyverno/chainsaw/pkg/report"
"github.com/kyverno/chainsaw/pkg/resource"
apibindings "github.com/kyverno/chainsaw/pkg/runner/bindings"
"github.com/kyverno/chainsaw/pkg/runner/cleanup"
"github.com/kyverno/chainsaw/pkg/runner/clusters"
Expand Down

0 comments on commit 9a9d0ec

Please sign in to comment.