cli: add field docs to the state file (#2453)

* add field docs to the state file

* mark only optional fields

* tidy

* use talos encoder
This commit is contained in:
Moritz Sanft 2023-10-16 16:49:07 +02:00 committed by GitHub
parent afb154ceb7
commit e5513f14e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 319 additions and 45 deletions

View file

@ -11,9 +11,9 @@ import (
"github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/edgelesssys/constellation/v2/internal/file"
"github.com/siderolabs/talos/pkg/machinery/config/encoder"
"github.com/spf13/afero"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
)
var defaultState = &State{
@ -145,7 +145,7 @@ func TestReadFromFile(t *testing.T) {
func mustMarshalYaml(t *testing.T, v any) []byte {
t.Helper()
b, err := yaml.Marshal(v)
b, err := encoder.NewEncoder(v).Encode()
if err != nil {
t.Fatalf("failed to marshal yaml: %v", err)
}