mirror of
				https://github.com/siderolabs/talos.git
				synced 2025-10-31 08:21:25 +01:00 
			
		
		
		
	This implements two controllers: one which generates templates for `/etc/hosts` and `/etc/resolv.config`, and another generic controller which renders files to `/etc` via shadow bind mounts. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
		
			
				
	
	
		
			34 lines
		
	
	
		
			975 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			975 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 files_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/files"
 | |
| )
 | |
| 
 | |
| func TestRegisterResource(t *testing.T) {
 | |
| 	ctx := context.TODO()
 | |
| 
 | |
| 	resources := state.WrapCore(namespaced.NewState(inmem.Build))
 | |
| 	resourceRegistry := registry.NewResourceRegistry(resources)
 | |
| 
 | |
| 	for _, resource := range []resource.Resource{
 | |
| 		&files.EtcFileSpec{},
 | |
| 		&files.EtcFileStatus{},
 | |
| 	} {
 | |
| 		assert.NoError(t, resourceRegistry.Register(ctx, resource))
 | |
| 	}
 | |
| }
 |