mirror of
https://github.com/siderolabs/discovery-service.git
synced 2025-03-14 09:55:08 +00:00
Change date is 4 years from now, change license is MPL 2.0. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
34 lines
812 B
Go
34 lines
812 B
Go
// Copyright (c) 2021 Sidero Labs, Inc.
|
|
//
|
|
// Use of this software is governed by the Business Source License
|
|
// included in the LICENSE file.
|
|
|
|
package server //nolint:testpackage
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestParseVersion(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
for v, expected := range map[string]string{
|
|
"": "unknown",
|
|
"unknown": "unknown",
|
|
"v0.13.0": "v0.13.0",
|
|
"v0.13.0-beta.0": "v0.13.0-beta.0",
|
|
"v0.14.0-alpha.0-7-gf7d9f211": "v0.14.0-alpha.0-dev",
|
|
"v0.14.0-alpha.0-7-gf7d9f211-dirty": "v0.14.0-alpha.0-dev",
|
|
} {
|
|
v, expected := v, expected
|
|
|
|
t.Run(v, func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
assert.Equal(t, expected, parseVersion(v))
|
|
})
|
|
}
|
|
}
|