talos/pkg/machinery/resources/runtime/runtime_test.go
Andrey Smirnov 3623da136b
feat: provide a way to load Linux kernel modules
Fixes #4693

Machine configuration change plus very simple controllers which transform
config into the module spec and finally load modules.

There's no support for advanced features like module params and aliases,
but we can add it later.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2021-12-23 23:58:37 +03:00

36 lines
1.0 KiB
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package runtime_test
import (
"context"
"testing"
"github.com/cosi-project/runtime/pkg/resource"
"github.com/cosi-project/runtime/pkg/state"
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
"github.com/cosi-project/runtime/pkg/state/registry"
"github.com/stretchr/testify/assert"
"github.com/talos-systems/talos/pkg/machinery/resources/runtime"
)
func TestRegisterResource(t *testing.T) {
ctx := context.TODO()
resources := state.WrapCore(namespaced.NewState(inmem.Build))
resourceRegistry := registry.NewResourceRegistry(resources)
for _, resource := range []resource.Resource{
&runtime.KernelModuleSpec{},
&runtime.KernelParamSpec{},
&runtime.KernelParamStatus{},
&runtime.MountStatus{},
} {
assert.NoError(t, resourceRegistry.Register(ctx, resource))
}
}