-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e318071
commit 3200180
Showing
10 changed files
with
227 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package compdesc_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"ocm.software/ocm/api/ocm/compdesc" | ||
metav1 "ocm.software/ocm/api/ocm/compdesc/meta/v1" | ||
) | ||
|
||
var _ = Describe("Extra Identity Test Environment", func() { | ||
It("handles complete defaulting", func() { | ||
resources := compdesc.Resources{ | ||
compdesc.Resource{ | ||
ResourceMeta: compdesc.ResourceMeta{ | ||
ElementMeta: compdesc.ElementMeta{ | ||
Name: "res", | ||
Version: "v1", | ||
}, | ||
}, | ||
}, | ||
compdesc.Resource{ | ||
ResourceMeta: compdesc.ResourceMeta{ | ||
ElementMeta: compdesc.ElementMeta{ | ||
Name: "res", | ||
Version: "v2", | ||
}, | ||
}, | ||
}, | ||
} | ||
Expect(resources[0].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", compdesc.SystemIdentityVersion, "v1"))) | ||
Expect(resources[1].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", compdesc.SystemIdentityVersion, "v2"))) | ||
}) | ||
|
||
It("handles partial defaulting", func() { | ||
resources := compdesc.Resources{ | ||
compdesc.Resource{ | ||
ResourceMeta: compdesc.ResourceMeta{ | ||
ElementMeta: compdesc.ElementMeta{ | ||
Name: "res", | ||
Version: "v1", | ||
ExtraIdentity: metav1.NewExtraIdentity(compdesc.SystemIdentityVersion, "v1"), | ||
}, | ||
}, | ||
}, | ||
compdesc.Resource{ | ||
ResourceMeta: compdesc.ResourceMeta{ | ||
ElementMeta: compdesc.ElementMeta{ | ||
Name: "res", | ||
Version: "v2", | ||
}, | ||
}, | ||
}, | ||
} | ||
Expect(resources[0].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", compdesc.SystemIdentityVersion, "v1"))) | ||
Expect(resources[1].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", compdesc.SystemIdentityVersion, "v2"))) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
api/ocm/compdesc/versions/ocm.software/v3alpha1/id_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package v3alpha1_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
metav1 "ocm.software/ocm/api/ocm/compdesc/meta/v1" | ||
me "ocm.software/ocm/api/ocm/compdesc/versions/ocm.software/v3alpha1" | ||
) | ||
|
||
var _ = Describe("Extra Identity Test Environment", func() { | ||
It("handles complete defaulting", func() { | ||
resources := me.Resources{ | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v1", | ||
}, | ||
}, | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v2", | ||
}, | ||
}, | ||
} | ||
Expect(resources[0].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v1"))) | ||
Expect(resources[1].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v2"))) | ||
}) | ||
|
||
It("handles partial defaulting", func() { | ||
resources := me.Resources{ | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v1", | ||
ExtraIdentity: metav1.NewExtraIdentity(me.SystemIdentityVersion, "v1"), | ||
}, | ||
}, | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v2", | ||
}, | ||
}, | ||
} | ||
Expect(resources[0].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v1"))) | ||
Expect(resources[1].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v2"))) | ||
}) | ||
}) |
13 changes: 13 additions & 0 deletions
13
api/ocm/compdesc/versions/ocm.software/v3alpha1/suite_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package v3alpha1_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestConfig(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "v3alpha1 Test Suite") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package v2_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
metav1 "ocm.software/ocm/api/ocm/compdesc/meta/v1" | ||
me "ocm.software/ocm/api/ocm/compdesc/versions/v2" | ||
) | ||
|
||
var _ = Describe("Extra Identity Test Environment", func() { | ||
It("handles complete defaulting", func() { | ||
resources := me.Resources{ | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v1", | ||
}, | ||
}, | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v2", | ||
}, | ||
}, | ||
} | ||
Expect(resources[0].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v1"))) | ||
Expect(resources[1].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v2"))) | ||
}) | ||
|
||
It("handles partial defaulting", func() { | ||
resources := me.Resources{ | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v1", | ||
ExtraIdentity: metav1.NewExtraIdentity(me.SystemIdentityVersion, "v1"), | ||
}, | ||
}, | ||
me.Resource{ | ||
ElementMeta: me.ElementMeta{ | ||
Name: "res", | ||
Version: "v2", | ||
}, | ||
}, | ||
} | ||
Expect(resources[0].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v1"))) | ||
Expect(resources[1].GetIdentity(resources)).To(Equal(metav1.NewIdentity("res", me.SystemIdentityVersion, "v2"))) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package v2_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestConfig(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "v2 Test Suite") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters