diff --git a/tests/assisted/ztp/operator/internal/tsparams/operatorvars.go b/tests/assisted/ztp/operator/internal/tsparams/operatorvars.go index ec795a06a..9b02bd402 100644 --- a/tests/assisted/ztp/operator/internal/tsparams/operatorvars.go +++ b/tests/assisted/ztp/operator/internal/tsparams/operatorvars.go @@ -22,6 +22,7 @@ var ( // ReporterCRDsToDump tells to the reporter what CRs to dump. ReporterCRDsToDump = []k8sreporter.CRData{ {Cr: &corev1.SecretList{}}, + {Cr: &agentInstallV1Beta1.AgentServiceConfigList{}}, {Cr: &hivev1.ClusterDeploymentList{}}, {Cr: &hiveextV1Beta1.AgentClusterInstallList{}}, {Cr: &agentInstallV1Beta1.InfraEnvList{}}, diff --git a/tests/assisted/ztp/operator/tests/additional-trust-bundle.go b/tests/assisted/ztp/operator/tests/additional-trust-bundle.go index 40986860f..a3c0b67af 100644 --- a/tests/assisted/ztp/operator/tests/additional-trust-bundle.go +++ b/tests/assisted/ztp/operator/tests/additional-trust-bundle.go @@ -126,9 +126,15 @@ var _ = Describe( testSecret.Definition.Name) infraenv.Definition.Spec.AdditionalTrustBundle = additionalTrustCertificate _, err = infraenv.Create() - Expect(err).ToNot(HaveOccurred(), "error creating infraenv") - _, err := infraenv.WaitForDiscoveryISOCreation(time.Second * 20) - Expect(err).ToNot(HaveOccurred(), "error creating discovery iso") + Eventually(func() (string, error) { + infraenv.Object, err = infraenv.Get() + if err != nil { + return "", err + } + + return infraenv.Object.Status.ISODownloadURL, nil + }).WithTimeout(time.Minute*3).ProbeEvery(time.Second*3). + Should(Not(BeEmpty()), "error waiting for download url to be created") By("Checking additionalTrustBundle equal to additionalTrustCertificate") Expect(infraenv.Object.Spec.AdditionalTrustBundle). To(Equal(additionalTrustCertificate), "infraenv was created with wrong certificate") @@ -154,8 +160,15 @@ var _ = Describe( infraenv.Definition.Spec.AdditionalTrustBundle = additionalTrustCertificateEmpty _, err = infraenv.Create() Expect(err).ToNot(HaveOccurred(), "error creating infraenv") - _, err := infraenv.WaitForDiscoveryISOCreation(time.Second * 20) - Expect(err).To(HaveOccurred(), "error: infraenv successfully created with empty additionalTrustBundle") + Eventually(func() (string, error) { + infraenv.Object, err = infraenv.Get() + if err != nil { + return "", err + } + + return infraenv.Object.Status.ISODownloadURL, nil + }).WithTimeout(time.Minute*3).ProbeEvery(time.Second*3). + Should(BeEmpty(), "error waiting for download url to be created") By("Getting Infraenv") infraenv, err = assisted.PullInfraEnvInstall(HubAPIClient, "testinfraenv", trustBundleTestNS) Expect(err).ToNot(HaveOccurred(), "error in retrieving infraenv") diff --git a/tests/assisted/ztp/operator/tests/build-artifacts-rootfs.go b/tests/assisted/ztp/operator/tests/build-artifacts-rootfs.go index 14265ccf7..6e2d96d39 100644 --- a/tests/assisted/ztp/operator/tests/build-artifacts-rootfs.go +++ b/tests/assisted/ztp/operator/tests/build-artifacts-rootfs.go @@ -56,8 +56,15 @@ var _ = Describe( WithDefaultIPv4AgentClusterInstall().WithDefaultInfraEnv().Create() Expect(err).ToNot(HaveOccurred(), "error creating %s spoke resources", rootfsSpokeName) - _, err = rootfsSpokeResources.InfraEnv.WaitForDiscoveryISOCreation(time.Minute * 3) - Expect(err).ToNot(HaveOccurred(), "error waiting for download url to be created") + Eventually(func() (string, error) { + rootfsSpokeResources.InfraEnv.Object, err = rootfsSpokeResources.InfraEnv.Get() + if err != nil { + return "", err + } + + return rootfsSpokeResources.InfraEnv.Object.Status.ISODownloadURL, nil + }).WithTimeout(time.Minute*3).ProbeEvery(time.Second*3). + Should(Not(BeEmpty()), "error waiting for download url to be created") if _, err = os.Stat(rootfsDownloadDir); err != nil { err = os.RemoveAll(rootfsDownloadDir) diff --git a/tests/assisted/ztp/operator/tests/infraenv-multiarch-image.go b/tests/assisted/ztp/operator/tests/infraenv-multiarch-image.go index 1d809e951..55ce2e918 100644 --- a/tests/assisted/ztp/operator/tests/infraenv-multiarch-image.go +++ b/tests/assisted/ztp/operator/tests/infraenv-multiarch-image.go @@ -300,6 +300,8 @@ func createSpokeClusterNamespace() { // createSpokeClusterResources is a helper function that creates // spoke cluster resources required for the test. +// +//nolint:funlen func createSpokeClusterResources(cpuArch string, mismatchCPUArchitecture ...string) { By("Create pull-secret in the new namespace") @@ -365,8 +367,15 @@ func createSpokeClusterResources(cpuArch string, mismatchCPUArchitecture ...stri if len(mismatchCPUArchitecture) == 0 { By("Wait until the discovery iso is created for the infraenv") - _, err = infraEnvBuilder.WaitForDiscoveryISOCreation(300 * time.Second) - Expect(err).ToNot(HaveOccurred(), "error waiting for the discovery iso creation") + Eventually(func() (string, error) { + infraEnvBuilder.Object, err = infraEnvBuilder.Get() + if err != nil { + return "", err + } + + return infraEnvBuilder.Object.Status.ISODownloadURL, nil + }).WithTimeout(time.Minute*3).ProbeEvery(time.Second*3). + Should(Not(BeEmpty()), "error waiting for download url to be created") } else { By("Wait until infraenv shows an error for the mismatching image architecture") diff --git a/tests/assisted/ztp/operator/tests/osimage-clusterimageset-test.go b/tests/assisted/ztp/operator/tests/osimage-clusterimageset-test.go index 1b6c47f91..8a736de6e 100644 --- a/tests/assisted/ztp/operator/tests/osimage-clusterimageset-test.go +++ b/tests/assisted/ztp/operator/tests/osimage-clusterimageset-test.go @@ -112,8 +112,15 @@ var _ = Describe( WithClusterRef(osImageClusterImageSetName, osImageClusterImageSetName).Create() Expect(err).ToNot(HaveOccurred(), "error creating infraenv") - _, err = osImageClusterImageSetInfraEnv.WaitForDiscoveryISOCreation(time.Second * 20) - Expect(err).ToNot(HaveOccurred(), "error waiting for discovery iso to be generated") + Eventually(func() (string, error) { + osImageClusterImageSetInfraEnv.Object, err = osImageClusterImageSetInfraEnv.Get() + if err != nil { + return "", err + } + + return osImageClusterImageSetInfraEnv.Object.Status.ISODownloadURL, nil + }).WithTimeout(time.Minute*3).ProbeEvery(time.Second*3). + Should(Not(BeEmpty()), "error waiting for download url to be created") }) AfterAll(func() {