talos/pkg/imager/quirks/quirks_test.go
Andrey Smirnov 0a30ef7845
fix: imager should support different Talos versions
Add some quirks to make images generated with newer Talos compatible
with images generated by older Talos.

Specifically, reset options were adding in Talos 1.4, so we shouldn't
add them for older versions.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2023-12-22 16:13:34 +04:00

38 lines
725 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 quirks_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/siderolabs/talos/pkg/imager/quirks"
)
func TestSupportsResetOption(t *testing.T) {
for _, test := range []struct {
version string
expected bool
}{
{
version: "1.5.0",
expected: true,
},
{
expected: true,
},
{
version: "1.3.7",
expected: false,
},
} {
t.Run(test.version, func(t *testing.T) {
assert.Equal(t, test.expected, quirks.New(test.version).SupportsResetGRUBOption())
})
}
}