mirror of https://github.com/kubernetes/kops.git
Update tests/integration/channel/integration_test.go
Co-authored-by: Ciprian Hacman <ciprianhacman@gmail.com>
This commit is contained in:
parent
b0fd89a193
commit
5f59b86c78
|
|
@ -392,42 +392,26 @@ func semverString(sv *semver.Version) string {
|
||||||
return sv.String()
|
return sv.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// All Image in stable hannel should have a specified upstream image prefix
|
// All Images in channel should have a specified upstream image prefix
|
||||||
func TestStableChannel(t *testing.T) {
|
func TestChannelImages(t *testing.T) {
|
||||||
sourcePath := "../../../channels/stable"
|
for _, channel := range []string{"stable", "alpha"} {
|
||||||
sourceBytes, err := ioutil.ReadFile(sourcePath)
|
t.Run(channel+"-channel", func(t *testing.T) {
|
||||||
if err != nil {
|
sourcePath := "../../../channels/" + channel
|
||||||
t.Fatalf("unexpected error reading sourcePath %q: %v", sourcePath, err)
|
sourceBytes, err := ioutil.ReadFile(sourcePath)
|
||||||
}
|
if err != nil {
|
||||||
|
t.Fatalf("unexpected error reading sourcePath %q: %v", sourcePath, err)
|
||||||
|
}
|
||||||
|
|
||||||
channel, err := kops.ParseChannel(sourceBytes)
|
channel, err := kops.ParseChannel(sourceBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to parse channel: %v", err)
|
t.Fatalf("failed to parse channel: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, image := range channel.Spec.Images {
|
for _, image := range channel.Spec.Images {
|
||||||
if !channel.HasUpstreamImagePrefix(image.Name) {
|
if !channel.HasUpstreamImagePrefix(image.Name) {
|
||||||
t.Errorf("Stable image '%s' has not a recognized prefix. Add the correct prefix to HasUpstreamImagePrefix function", image.Name)
|
t.Errorf("unknown image prefix: %q", 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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue