2023-03-30 21:49:39 +02:00
|
|
|
// Copyright The OpenTelemetry Authors
|
2024-02-29 08:05:28 +02:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2023-03-30 21:49:39 +02:00
|
|
|
|
|
|
|
package sdk_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"regexp"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
2023-04-14 16:41:27 +02:00
|
|
|
"go.opentelemetry.io/otel/sdk"
|
2023-03-30 21:49:39 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1
|
|
|
|
var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` +
|
|
|
|
`(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
|
|
|
|
`(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`)
|
|
|
|
|
|
|
|
func TestVersionSemver(t *testing.T) {
|
2023-04-14 16:41:27 +02:00
|
|
|
v := sdk.Version()
|
2023-03-30 21:49:39 +02:00
|
|
|
assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v)
|
|
|
|
}
|