diff --git a/cmd/oras/root/version.go b/cmd/oras/root/version.go index fb4f510ec..4f65c93b6 100644 --- a/cmd/oras/root/version.go +++ b/cmd/oras/root/version.go @@ -58,6 +58,7 @@ func runVersion(printer *output.Printer) error { items := [][]string{ {"Version", version.GetVersion()}, {"Go version", runtime.Version()}, + {"OS/Arch", fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)}, } if version.GitCommit != "" { items = append(items, []string{"Git commit", version.GitCommit}) diff --git a/test/e2e/suite/command/version_darwin.go b/test/e2e/suite/command/version_darwin.go new file mode 100644 index 000000000..0b5384ada --- /dev/null +++ b/test/e2e/suite/command/version_darwin.go @@ -0,0 +1,31 @@ +//go:build darwin + +/* +Copyright The ORAS 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 command + +import ( + . "github.com/onsi/ginkgo/v2" + . "oras.land/oras/test/e2e/internal/utils" +) + +var _ = Describe("ORAS darwin user:", func() { + When("checking oras version", func() { + It("should run version command and show OS/Arch information", func() { + ORAS("version").MatchKeyWords("OS/Arch:", "darwin/").Exec() + }) + }) +}) diff --git a/test/e2e/suite/command/version_linux.go b/test/e2e/suite/command/version_linux.go new file mode 100644 index 000000000..aae8d77b7 --- /dev/null +++ b/test/e2e/suite/command/version_linux.go @@ -0,0 +1,31 @@ +//go:build linux + +/* +Copyright The ORAS 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 command + +import ( + . "github.com/onsi/ginkgo/v2" + . "oras.land/oras/test/e2e/internal/utils" +) + +var _ = Describe("ORAS linux user:", func() { + When("checking oras version", func() { + It("should run version command and show OS/Arch information", func() { + ORAS("version").MatchKeyWords("OS/Arch:", "linux/").Exec() + }) + }) +})