discovery-service/pkg/server/version_test.go
Andrey Smirnov a0e6313af7 chore: relicense under BSL-1.1
Change date is 4 years from now, change license is MPL 2.0.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2021-10-28 23:13:26 +03:00

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))
})
}
}