Skip to content

Commit

Permalink
Merge pull request #38 from spinkube/refactor-project-structure
Browse files Browse the repository at this point in the history
Refactor project structure
  • Loading branch information
toksikk authored Mar 11, 2024
2 parents 6ec8edd + c1689ab commit 39f419c
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions cmd/node-installer/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/spf13/afero"
main "github.com/spinkube/runtime-class-manager/cmd/node-installer"
"github.com/spinkube/runtime-class-manager/tests"
tests "github.com/spinkube/runtime-class-manager/tests/node-installer"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -56,8 +56,8 @@ func Test_RunInstall(t *testing.T) {
}{"/opt/kwasm", "/assets"},
struct{ RootPath string }{"/containerd/missing-containerd-shim-config"},
},
tests.FixtureFs("../../testdata"),
tests.FixtureFs("../../testdata/containerd/missing-containerd-shim-config"),
tests.FixtureFs("../../testdata/node-installer"),
tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-shim-config"),
},
false,
},
Expand All @@ -75,8 +75,8 @@ func Test_RunInstall(t *testing.T) {
}{"/opt/kwasm", "/assets"},
struct{ RootPath string }{"/containerd/existing-containerd-shim-config"},
},
tests.FixtureFs("../../testdata"),
tests.FixtureFs("../../testdata/containerd/existing-containerd-shim-config"),
tests.FixtureFs("../../testdata/node-installer"),
tests.FixtureFs("../../testdata/node-installer/containerd/existing-containerd-shim-config"),
},
false,
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions pkg/containerd/configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"

"github.com/spf13/afero"
"github.com/spinkube/runtime-class-manager/tests"
tests "github.com/spinkube/runtime-class-manager/tests/node-installer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -41,7 +41,7 @@ func TestConfig_AddRuntime(t *testing.T) {
wantFileContent string
}{
{"missing shim config", fields{
hostFs: tests.FixtureFs("../../testdata/containerd/missing-containerd-shim-config"),
hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-shim-config"),
configPath: "/etc/containerd/config.toml",
}, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins]
[plugins."io.containerd.monitor.v1.cgroups"]
Expand All @@ -66,11 +66,11 @@ func TestConfig_AddRuntime(t *testing.T) {
runtime_type = "/opt/kwasm/bin/containerd-shim-spin-v1"
`},
{"missing config", fields{
hostFs: tests.FixtureFs("../../testdata/containerd/missing-containerd-config"),
hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-config"),
configPath: "/etc/containerd/config.toml",
}, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, true, ``},
{"existing shim config", fields{
hostFs: tests.FixtureFs("../../testdata/containerd/existing-containerd-shim-config"),
hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/existing-containerd-shim-config"),
configPath: "/etc/containerd/config.toml",
}, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins]
[plugins."io.containerd.monitor.v1.cgroups"]
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestConfig_RemoveRuntime(t *testing.T) {
wantFileContent string
}{
{"missing shim config", fields{
hostFs: tests.FixtureFs("../../testdata/containerd/missing-containerd-shim-config"),
hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-shim-config"),
configPath: "/etc/containerd/config.toml",
}, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins]
[plugins."io.containerd.monitor.v1.cgroups"]
Expand All @@ -155,11 +155,11 @@ func TestConfig_RemoveRuntime(t *testing.T) {
rdt_config_file = ""
`},
{"missing config", fields{
hostFs: tests.FixtureFs("../../testdata/containerd/missing-containerd-config"),
hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-config"),
configPath: "/etc/containerd/config.toml",
}, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, true, ``},
{"existing shim config", fields{
hostFs: tests.FixtureFs("../../testdata/containerd/existing-containerd-shim-config"),
hostFs: tests.FixtureFs("../../testdata/node-installer/containerd/existing-containerd-shim-config"),
configPath: "/etc/containerd/config.toml",
}, args{"/opt/kwasm/bin/containerd-shim-spin-v1"}, false, `[plugins]
[plugins."io.containerd.monitor.v1.cgroups"]
Expand Down
16 changes: 8 additions & 8 deletions pkg/shim/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"

"github.com/spf13/afero"
"github.com/spinkube/runtime-class-manager/tests"
tests "github.com/spinkube/runtime-class-manager/tests/node-installer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -49,8 +49,8 @@ func TestConfig_Install(t *testing.T) {
{
"no changes to shim",
fields{
tests.FixtureFs("../../testdata"),
tests.FixtureFs("../../testdata/shim"),
tests.FixtureFs("../../testdata/node-installer"),
tests.FixtureFs("../../testdata/node-installer/shim"),
"/assets",
"/opt/kwasm",
},
Expand All @@ -64,8 +64,8 @@ func TestConfig_Install(t *testing.T) {
{
"install new shim over old",
fields{
tests.FixtureFs("../../testdata"),
tests.FixtureFs("../../testdata/shim"),
tests.FixtureFs("../../testdata/node-installer"),
tests.FixtureFs("../../testdata/node-installer/shim"),
"/assets",
"/opt/kwasm",
},
Expand All @@ -80,7 +80,7 @@ func TestConfig_Install(t *testing.T) {
"unable to find new shim",
fields{
afero.NewMemMapFs(),
tests.FixtureFs("../../testdata/shim"),
tests.FixtureFs("../../testdata/node-installer/shim"),
"/assets",
"/opt/kwasm",
},
Expand All @@ -94,8 +94,8 @@ func TestConfig_Install(t *testing.T) {
{
"unable to write to hostFs",
fields{
tests.FixtureFs("../../testdata"),
afero.NewReadOnlyFs(tests.FixtureFs("../../testdata/shim")),
tests.FixtureFs("../../testdata/node-installer"),
afero.NewReadOnlyFs(tests.FixtureFs("../../testdata/node-installer/shim")),
"/assets",
"/opt/kwasm",
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/spf13/afero"
"github.com/spinkube/runtime-class-manager/pkg/state"
"github.com/spinkube/runtime-class-manager/tests"
tests "github.com/spinkube/runtime-class-manager/tests/node-installer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -24,7 +24,7 @@ func TestGet(t *testing.T) {
{
"existing state",
args{
tests.FixtureFs("../../testdata/containerd/existing-containerd-shim-config"),
tests.FixtureFs("../../testdata/node-installer/containerd/existing-containerd-shim-config"),
"/opt/kwasm",
},
&state.State{
Expand All @@ -40,7 +40,7 @@ func TestGet(t *testing.T) {
{
"missing state",
args{
tests.FixtureFs("../../testdata/containerd/missing-containerd-shim-config"),
tests.FixtureFs("../../testdata/node-installer/containerd/missing-containerd-shim-config"),
"/opt/kwasm",
},
&state.State{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 39f419c

Please sign in to comment.