Update tests/integration/channel/integration_test.go

Co-authored-by: Ciprian Hacman <ciprianhacman@gmail.com>
This commit is contained in:
Nicolas Vanheuverzwijn 2020-10-14 13:23:04 -04:00 committed by GitHub
parent b0fd89a193
commit 5f59b86c78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 35 deletions

View File

@ -392,42 +392,26 @@ func semverString(sv *semver.Version) string {
return sv.String()
}
// All Image in stable hannel should have a specified upstream image prefix
func TestStableChannel(t *testing.T) {
sourcePath := "../../../channels/stable"
sourceBytes, err := ioutil.ReadFile(sourcePath)
if err != nil {
t.Fatalf("unexpected error reading sourcePath %q: %v", sourcePath, err)
}
// All Images in channel should have a specified upstream image prefix
func TestChannelImages(t *testing.T) {
for _, channel := range []string{"stable", "alpha"} {
t.Run(channel+"-channel", func(t *testing.T) {
sourcePath := "../../../channels/" + channel
sourceBytes, err := ioutil.ReadFile(sourcePath)
if err != nil {
t.Fatalf("unexpected error reading sourcePath %q: %v", sourcePath, err)
}
channel, err := kops.ParseChannel(sourceBytes)
if err != nil {
t.Fatalf("failed to parse channel: %v", err)
}
channel, err := kops.ParseChannel(sourceBytes)
if err != nil {
t.Fatalf("failed to parse channel: %v", err)
}
for _, image := range channel.Spec.Images {
if !channel.HasUpstreamImagePrefix(image.Name) {
t.Errorf("Stable image '%s' has not a recognized prefix. Add the correct prefix to HasUpstreamImagePrefix function", image.Name)
}
}
}
// All Image in stable hannel should have a specified upstream image prefix
func TestAlphaChannel(t *testing.T) {
sourcePath := "../../../channels/alpha"
sourceBytes, err := ioutil.ReadFile(sourcePath)
if err != nil {
t.Fatalf("unexpected error reading sourcePath %q: %v", sourcePath, err)
}
channel, err := kops.ParseChannel(sourceBytes)
if err != nil {
t.Fatalf("failed to parse channel: %v", err)
}
for _, image := range channel.Spec.Images {
if !channel.HasUpstreamImagePrefix(image.Name) {
t.Errorf("Alpha image channel '%s' has not a recognized prefix. Add the correct prefix to HasUpstreamImagePrefix function", image.Name)
}
for _, image := range channel.Spec.Images {
if !channel.HasUpstreamImagePrefix(image.Name) {
t.Errorf("unknown image prefix: %q", image.Name)
}
}
})
}
}