diff --git a/pkg/contexts/ocm/repositories/genericocireg/repo_test.go b/pkg/contexts/ocm/repositories/genericocireg/repo_test.go index 51a7b35305..50ab789483 100644 --- a/pkg/contexts/ocm/repositories/genericocireg/repo_test.go +++ b/pkg/contexts/ocm/repositories/genericocireg/repo_test.go @@ -1,7 +1,3 @@ -// SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and Open Component Model contributors. -// -// SPDX-License-Identifier: Apache-2.0 - package genericocireg_test import ( @@ -9,12 +5,10 @@ import ( "path" "reflect" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - . "github.com/open-component-model/ocm/pkg/testutils" - "github.com/mandelsoft/vfs/pkg/osfs" "github.com/mandelsoft/vfs/pkg/vfs" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" "github.com/opencontainers/go-digest" "github.com/open-component-model/ocm/pkg/blobaccess" @@ -50,6 +44,7 @@ import ( "github.com/open-component-model/ocm/pkg/finalizer" "github.com/open-component-model/ocm/pkg/mime" "github.com/open-component-model/ocm/pkg/signing/hasher/sha256" + . "github.com/open-component-model/ocm/pkg/testutils" ) var DefaultContext = ocm.New() @@ -79,6 +74,15 @@ var _ = Describe("component repository mapping", func() { vfs.Cleanup(tempfs) }) + It("Don't Panik! When it's not a semver.org conform version. #756", func() { + repo := Must(DefaultContext.RepositoryForSpec(spec)) + comp := Must(repo.LookupComponent(COMPONENT)) + cva, err := comp.NewVersion("v1.two.zeo-2") + Expect(err).To(HaveOccurred()) + Expect(cva).To(BeNil()) + Expect(err.Error()).To(Equal("Invalid Semantic Version")) + }) + It("creates a dummy component", func() { var finalize finalizer.Finalizer defer Defer(finalize.Finalize)