mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-01 18:51:13 +02:00
Previously, if META values were supplied to the Talos ISO via environment variable, they will be written down and available after the install. With this fix, values are also readable and available before the installation runs (in maintenance mode). Most of the PR is refactoring `meta.Value(s)` to be a shared library which is used by the installer/imager and (now) Talos. Also fixes an issue with not returning properly `NotExist` error when META is not yet available as a partition on disk. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
33 lines
728 B
Go
33 lines
728 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 install_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/siderolabs/talos/cmd/installer/pkg/install"
|
|
)
|
|
|
|
func TestMetaValues(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
var s install.MetaValues
|
|
|
|
require.NoError(t, s.Set("10=foo"))
|
|
require.NoError(t, s.Append("20=bar"))
|
|
|
|
assert.Equal(t, "[0xa=foo,0x14=bar]", s.String())
|
|
|
|
encoded := s.Encode()
|
|
|
|
var s2 install.MetaValues
|
|
|
|
require.NoError(t, s2.Decode(encoded))
|
|
assert.Equal(t, s.String(), s2.String())
|
|
}
|