util: add test case for WSL kernel version parsing

This commit is contained in:
Mauri de Souza Meneguzzo 2024-05-26 18:40:10 -03:00
parent 4bb434501d
commit 7fcaaa5585

View File

@ -46,6 +46,13 @@ func TestGetVersion(t *testing.T) {
},
expected: version.MajorMinor(5, 4),
},
{
name: "valid microsoft WSL2 kernel version",
readFileFunc: func(_ string) ([]byte, error) {
return []byte("5.15.146.1-microsoft-standard-WSL2"), nil
},
expected: version.MajorMinor(5, 15).WithPatch(146),
},
{
name: "failed to read os-release file",
readFileFunc: func(_ string) ([]byte, error) {