Skip to content

Commit

Permalink
fix integration tests, bad logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdyoung committed Feb 20, 2024
1 parent 6be29c9 commit 29ddf2f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions pkg/asset/agent/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func IsSupportedPlatform(platform hiveext.PlatformType) bool {
}
return false
}

// DetermineReleaseImageArch returns the arch of the release image.
func DetermineReleaseImageArch(pullSecret, pullSpec string) (string, error) {
templateFilter := "-o=go-template='{{if and .metadata.metadata (index . \"metadata\" \"metadata\" \"release.openshift.io/architecture\")}}{{index . \"metadata\" \"metadata\" \"release.openshift.io/architecture\"}}{{else}}{{.config.architecture}}{{end}}'"
Expand All @@ -70,11 +71,11 @@ func DetermineReleaseImageArch(pullSecret, pullSpec string) (string, error) {
pullSpec,
templateFilter,
}
releaseArch, testerr := ExecuteOC(pullSecret, getReleaseArch)
if testerr != nil {
logrus.Warnf("Release Image arch could not be found: %s", testerr)
} else {
logrus.Debugf("Release Image arch is: %s", releaseArch)
releaseArch, err := ExecuteOC(pullSecret, getReleaseArch)
if err != nil {
logrus.Errorf("Release Image arch could not be found: %s", err)
return "", err
}
logrus.Debugf("Release Image arch is: %s", releaseArch)
return releaseArch, nil
}
2 changes: 1 addition & 1 deletion pkg/asset/agent/image/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
// Examine the release payload to see if its multi
releaseArch, err := agentcommon.DetermineReleaseImageArch(agentManifests.GetPullSecretData(), agentManifests.ClusterImageSet.Spec.ReleaseImage)
if err != nil {
logrus.Warnf("Unable to validate the release image architecture, using infraEnv.Spec.CpuArchitecture are release image arch")
logrus.Warnf("Unable to validate the release image architecture, using infraEnv.Spec.CpuArchitecture for the release image arch")
releaseArch = archName
} else {
releaseArch = arch.RpmArch(releaseArch)
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/agent/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
)

const (
// InstallConfigFilename is the file containing the install-config.
InstallConfigFilename = "install-config.yaml"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/agent/installconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ platform:
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"c3VwZXItc2VjcmV0Cg==\"}}}"
`,
expectedFound: false,
expectedError: "invalid install-config configuration: [Platform: Invalid value: \"baremetal\": CPU architecture \"ppc64le\" only supports platform \"none\"., ControlPlane.Architecture: Forbidden: unsupported release image architecture. ControlPlane Arch: ppc64le doesn't match Release Image Arch: amd64]",
expectedError: "invalid install-config configuration: Platform: Invalid value: \"baremetal\": CPU architecture \"ppc64le\" only supports platform \"none\".",
},
{
name: "invalid platform.baremetal for architecture s390x",
Expand Down Expand Up @@ -374,7 +374,7 @@ platform:
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"c3VwZXItc2VjcmV0Cg==\"}}}"
`,
expectedFound: false,
expectedError: "invalid install-config configuration: [Platform: Invalid value: \"baremetal\": CPU architecture \"s390x\" only supports platform \"none\"., ControlPlane.Architecture: Forbidden: unsupported release image architecture. ControlPlane Arch: s390x doesn't match Release Image Arch: amd64]",
expectedError: "invalid install-config configuration: Platform: Invalid value: \"baremetal\": CPU architecture \"s390x\" only supports platform \"none\".",
},
{
name: "generic platformName for external platform",
Expand Down

0 comments on commit 29ddf2f

Please sign in to comment.