Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions test/extended/image_ecosystem/s2i_ruby.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
e2e "k8s.io/kubernetes/test/e2e/framework"

"k8s.io/apimachinery/pkg/api/errors"

exutil "github.com/openshift/origin/test/extended/util"
)

Expand Down Expand Up @@ -45,10 +47,6 @@ var _ = g.Describe("[sig-devex][Feature:ImageEcosystem][ruby][Slow] hot deploy f

g.Describe("Rails example", func() {
g.It(fmt.Sprintf("should work with hot deploy [apigroup:image.openshift.io][apigroup:operator.openshift.io][apigroup:config.openshift.io][apigroup:build.openshift.io]"), func() {
// The rails sample is not supported in the Samples operator and has bitrotten. Let's skip the test but keep the test code around
// just in case the sample gets resurrected in the future.
g.Skip("The rails-postgresql-example is not working anymore and is not supported by the samples operator (since OCP 4.16) so let's not use it for tests.")

exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc new-app %q", railsTemplate))
err := oc.Run("new-app").Args(railsTemplate).Execute()
Expand All @@ -59,9 +57,13 @@ var _ = g.Describe("[sig-devex][Feature:ImageEcosystem][ruby][Slow] hot deploy f
if err != nil {
exutil.DumpBuildLogs(dcName, oc)
}

o.Expect(err).NotTo(o.HaveOccurred())

err = exutil.WaitForDeploymentConfig(oc.KubeClient(), oc.AppsClient().AppsV1(), oc.Namespace(), dcName, 1, true, oc)
if errors.IsNotFound(err) {
err = exutil.WaitForDeploymentReady(oc, dcName, oc.Namespace())
}
o.Expect(err).NotTo(o.HaveOccurred())

g.By("waiting for endpoint")
Expand Down
10 changes: 10 additions & 0 deletions test/extended/image_ecosystem/sample_repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

"k8s.io/apimachinery/pkg/util/wait"

"k8s.io/apimachinery/pkg/api/errors"

e2e "k8s.io/kubernetes/test/e2e/framework"

exutil "github.com/openshift/origin/test/extended/util"
Expand Down Expand Up @@ -77,11 +79,19 @@ func NewSampleRepoTest(c sampleRepoConfig) func() {

g.By("expecting the app deployment to be complete")
err = exutil.WaitForDeploymentConfig(oc.KubeClient(), oc.AppsClient().AppsV1(), oc.Namespace(), c.deploymentConfigName, 1, true, oc)
if errors.IsNotFound(err) {
// ok, this is template is not using DeploymentConfig. Let's try with Deployment instead.
err = exutil.WaitForDeploymentReady(oc, c.deploymentConfigName, oc.Namespace())
}
o.Expect(err).NotTo(o.HaveOccurred())

if len(c.dbDeploymentConfigName) > 0 {
g.By("expecting the db deployment to be complete")
err = exutil.WaitForDeploymentConfig(oc.KubeClient(), oc.AppsClient().AppsV1(), oc.Namespace(), c.dbDeploymentConfigName, 1, true, oc)
if errors.IsNotFound(err) {
// ok, this template is most probably not using DeploymentConfig. Let's try with Deployment instead.
err = exutil.WaitForDeploymentReady(oc, c.dbDeploymentConfigName, oc.Namespace())
}
o.Expect(err).NotTo(o.HaveOccurred())

g.By("expecting the db service is available")
Expand Down
1 change: 1 addition & 0 deletions test/extended/util/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func WaitForDeploymentReady(oc *CLI, deployName, namespace string) error {
deployment, getErr = oc.AdminKubeClient().AppsV1().Deployments(namespace).Get(context.Background(), deployName, metav1.GetOptions{})
if getErr != nil {
e2e.Logf("Unable to retrieve deployment %q:\n%v", deployName, getErr)
return false, nil
}
if deployment.Status.AvailableReplicas == *deployment.Spec.Replicas {
e2e.Logf("Deployment %q is ready", deployName)
Expand Down