Skip to content

Commit 7fcaaa5

Browse files
committed
util: add test case for WSL kernel version parsing
1 parent 4bb4345 commit 7fcaaa5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/util/kernel/version_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ func TestGetVersion(t *testing.T) {
4646
},
4747
expected: version.MajorMinor(5, 4),
4848
},
49+
{
50+
name: "valid microsoft WSL2 kernel version",
51+
readFileFunc: func(_ string) ([]byte, error) {
52+
return []byte("5.15.146.1-microsoft-standard-WSL2"), nil
53+
},
54+
expected: version.MajorMinor(5, 15).WithPatch(146),
55+
},
4956
{
5057
name: "failed to read os-release file",
5158
readFileFunc: func(_ string) ([]byte, error) {

0 commit comments

Comments
 (0)