Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added version.go and test file for issue 2143 #3677

Merged
merged 31 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9ef3922
added version.go and test file for issue 2143
ChillOrb Feb 5, 2023
617f3f8
Merge branch 'main' into main
hanyuancheung Feb 6, 2023
f67ff81
added license in metric versiont_test
ChillOrb Feb 6, 2023
a900c28
goimport file linting
ChillOrb Feb 8, 2023
02e3141
Merge pull request #1 from ChillOrb/dev
ChillOrb Feb 8, 2023
debc6bd
Merge branch 'main' into main
ChillOrb Feb 8, 2023
87ba255
Merge branch 'main' into main
ChillOrb Feb 9, 2023
707fce6
Merge branch 'open-telemetry:main' into main
ChillOrb Feb 10, 2023
18f659f
update trace version to v.1.13.0 and metric to 0.36.0
ChillOrb Feb 12, 2023
e1da578
Merge branch 'main' into main
ChillOrb Feb 18, 2023
450b70c
Update sdk/metric/version.go
ChillOrb Feb 21, 2023
4ad58dc
using asser.Regxp
ChillOrb Feb 21, 2023
4d51324
changing regex string as per recommendations
ChillOrb Feb 22, 2023
f2f52dc
Merge branch 'main' into main
ChillOrb Feb 22, 2023
65b4e33
changing regex string as per recommendations
ChillOrb Feb 22, 2023
9705f8f
reverting go mod and go sum changes
ChillOrb Feb 25, 2023
b581ce0
Merge branch 'main' into main
ChillOrb Feb 25, 2023
7e75dc2
Merge branch 'main' into main
ChillOrb Feb 27, 2023
ebc67e9
Merge branch 'main' into main
ChillOrb Feb 28, 2023
7a09571
trace and metric version bump up
ChillOrb Feb 28, 2023
b0db435
Merge branch 'main' into main
ChillOrb Mar 2, 2023
7462b4a
Merge branch 'open-telemetry:main' into main
ChillOrb Mar 4, 2023
7d3799e
version update in sdk/metric , sdk/trace
ChillOrb Mar 4, 2023
96dc693
Merge branch 'open-telemetry:main' into main
ChillOrb Mar 7, 2023
aecaa1a
Merge branch 'open-telemetry:main' into main
ChillOrb Mar 8, 2023
9fff3bb
doc typo fix
ChillOrb Mar 8, 2023
7756059
Merge branch 'main' into main
ChillOrb Mar 9, 2023
7244952
Merge branch 'open-telemetry:main' into main
ChillOrb Mar 19, 2023
3b1bb72
Apply suggestions from code review
MrAlias May 9, 2023
d8c68af
Merge branch 'main' into main
MrAlias May 9, 2023
847d7ac
Merge branch 'main' into main
MrAlias May 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions sdk/metric/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package metric // import "go.opentelemetry.io/otel/sdk/metric"

// version is the current release version of the metric SDK in use.
func version() string {
pellared marked this conversation as resolved.
Show resolved Hide resolved
return "1.15.0-rc.1"
MrAlias marked this conversation as resolved.
Show resolved Hide resolved
}
33 changes: 33 additions & 0 deletions sdk/metric/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package metric

import (
"regexp"
"testing"

"github.com/stretchr/testify/assert"
)

// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1
var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)` +
`(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)` +
`(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` +
`(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`)

func TestVersionSemver(t *testing.T) {
v := version()
assert.Regexp(t, versionRegex, v)
}
20 changes: 20 additions & 0 deletions sdk/trace/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package trace // import "go.opentelemetry.io/otel/sdk/trace"

// version is the current release version of the metric SDK in use.
func version() string {
return "1.15.0-rc.1"
MrAlias marked this conversation as resolved.
Show resolved Hide resolved
}
32 changes: 32 additions & 0 deletions sdk/trace/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package trace

import (
"regexp"
"testing"

"github.com/stretchr/testify/assert"
)

var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)` +
`(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)` +
`(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` +
`(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`)

func TestVersionSemver(t *testing.T) {
v := version()
assert.Regexp(t, versionRegex, v)
}
9 changes: 5 additions & 4 deletions version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import (
"go.opentelemetry.io/otel"
)

// 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\-]+)*))?$`)
// regex taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)` +
pellared marked this conversation as resolved.
Show resolved Hide resolved
`(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)` +
`(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` +
`(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`)

func TestVersionSemver(t *testing.T) {
v := otel.Version()
Expand Down