mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-09-19 12:34:44 -04:00
Feat/version manifests (#387)
Signed-off-by: Fabian Kammel <fk@edgeless.systems> Co-authored-by: Otto Bittner <cobittner@posteo.net>
This commit is contained in:
parent
cdcbed6ff9
commit
ec79484948
8 changed files with 377 additions and 0 deletions
38
hack/build-manifest/gcp/options_test.go
Normal file
38
hack/build-manifest/gcp/options_test.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package gcp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIsGcpReleaseImage(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
image string
|
||||
wantVersion string
|
||||
wantError bool
|
||||
}{
|
||||
"works for release image": {
|
||||
image: "projects/constellation-images/global/images/constellation-v1-3-0",
|
||||
wantVersion: "v1.3.0",
|
||||
},
|
||||
"breaks for debug image": {
|
||||
image: "projects/constellation-images/global/images/constellation-20220805151600",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
version, err := isGcpReleaseImage(tc.image)
|
||||
if tc.wantError {
|
||||
assert.Error(err)
|
||||
return
|
||||
}
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.wantVersion, version)
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue