mirror of
				https://github.com/siderolabs/talos.git
				synced 2025-11-04 02:11:12 +01:00 
			
		
		
		
	Fixes #4133 This is pretty limited resource, as it covers only system mounts, but this is all we need for KubeSpan for now. More complete solution should probably involve COSIfying whole mount subsystem. Example: ``` $ talosctl -n 172.20.0.2 get mounts NODE NAMESPACE TYPE ID VERSION SOURCE TARGET FILESYSTEM TYPE 172.20.0.2 runtime MountStatus EPHEMERAL 1 /dev/vda6 /var xfs 172.20.0.2 runtime MountStatus STATE 1 /dev/vda5 /system/state xfs ``` Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			1017 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1017 B
		
	
	
	
		
			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/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.KernelParamSpec{},
 | 
						|
		&runtime.KernelParamStatus{},
 | 
						|
		&runtime.MountStatus{},
 | 
						|
	} {
 | 
						|
		assert.NoError(t, resourceRegistry.Register(ctx, resource))
 | 
						|
	}
 | 
						|
}
 |