talos/pkg/machinery/config/configloader/configloader_fuzz_test.go
Andrey Smirnov 6be5a13d5d
feat: implement machine config documents for event and log streaming
Fixes #7228

Add some changes to make Talos accept partial machine configuration
without main v1alpha1 config.

With this change, it's possible to connect a machine already running
with machine configuration (v1alpha1), the following patch will connect
to a local SideroLink endpoint:

```yaml
apiVersion: v1alpha1
kind: SideroLinkConfig
apiUrl: grpc://172.20.0.1:4000/?jointoken=foo
---
apiVersion: v1alpha1
kind: KmsgLogConfig
name: apiSink
url: tcp://[fdae:41e4:649b:9303::1]:4001/
---
apiVersion: v1alpha1
kind: EventSinkConfig
endpoint: "[fdae:41e4:649b:9303::1]:8080"
```

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2023-07-01 00:22:44 +04:00

37 lines
731 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/.
//go:build go1.18
package configloader_test
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func FuzzConfigLoader(f *testing.F) {
files, err := filepath.Glob(filepath.Join("testdata", "*.test"))
require.NoError(f, err)
for _, file := range files {
b, err := os.ReadFile(file)
require.NoError(f, err)
f.Add(b)
}
f.Add([]byte(": \xea"))
f.Add([]byte(nil))
f.Add([]byte(""))
f.Fuzz(func(t *testing.T, b []byte) {
t.Parallel()
testConfigLoaderBytes(t, b, false)
})
}