mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-19 13:41:13 +02:00
37 lines
1010 B
Go
37 lines
1010 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 kernel_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/autonomy/talos/internal/pkg/kernel"
|
|
)
|
|
|
|
type KernelSuite struct {
|
|
suite.Suite
|
|
}
|
|
|
|
func (suite *KernelSuite) TestParseKernelBootParameters() {
|
|
for _, t := range []struct {
|
|
params []byte
|
|
expected map[string]string
|
|
}{
|
|
{[]byte(""), map[string]string{}},
|
|
{[]byte("boot=xyz root=/dev/abc nogui"), map[string]string{"boot": "xyz", "root": "/dev/abc", "nogui": ""}},
|
|
{[]byte(" root=/dev/abc=1 nogui \n"), map[string]string{"root": "/dev/abc=1", "nogui": ""}},
|
|
{[]byte("root=/dev/sda root=/dev/sdb"), map[string]string{"root": "/dev/sdb"}},
|
|
} {
|
|
suite.Assert().Equal(t.expected, kernel.ParseKernelBootParameters(t.params))
|
|
}
|
|
|
|
}
|
|
|
|
func TestKernelSuite(t *testing.T) {
|
|
suite.Run(t, new(KernelSuite))
|
|
}
|