Skip to content

Commit

Permalink
Merge pull request #24082 from stlaz/ldap_test_dnf_retries
Browse files Browse the repository at this point in the history
Bug 1763988: LDAP e2e: add dnf install retries, extend run timeout
  • Loading branch information
openshift-merge-robot committed Nov 8, 2019
2 parents 9fccb2e + bdae732 commit 99175db
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 7 additions & 1 deletion test/extended/oauth/groupsync.go
Expand Up @@ -39,7 +39,13 @@ var _ = g.Describe("[Suite:openshift/oauth][Serial] ldap group sync", func() {
o.Expect(err).NotTo(o.HaveOccurred())

// Install stuff needed for the exec pod to run groupsync.sh and hack/lib
_, err = pod.Exec("dnf install findutils golang docker which bc openldap-clients -y")
for i := 0; i < 5; i++ {
if _, err = pod.Exec("dnf install -y findutils golang docker which bc openldap-clients"); err == nil {
break
}
// it apparently hit error syncing caches, clean all to try again
pod.Exec("dnf clean all")
}
o.Expect(err).NotTo(o.HaveOccurred())

// Copy oc
Expand Down
5 changes: 3 additions & 2 deletions test/extended/util/framework.go
Expand Up @@ -1625,8 +1625,9 @@ func RunOneShotCommandPod(
// Wait for command completion.
err = wait.PollImmediate(1*time.Second, timeout, func() (done bool, err error) {
cmdPod, getErr := oc.AdminKubeClient().CoreV1().Pods(oc.Namespace()).Get(pod.Name, v1.GetOptions{})
if err != nil {
return false, getErr
if getErr != nil {
e2e.Logf("failed to get pod %q: %v", pod.Name, err)
return false, nil
}

if podHasErrored(cmdPod) {
Expand Down
3 changes: 1 addition & 2 deletions test/extended/util/ldap.go
Expand Up @@ -176,8 +176,7 @@ func checkLDAPConn(oc *CLI, host string) error {
// Run an ldapsearch in a pod against host.
func runLDAPSearchInPod(oc *CLI, host string) (string, error) {
mounts, volumes := LDAPClientMounts()
output, errs := RunOneShotCommandPod(oc, "runonce-ldapsearch-pod", OpenLDAPTestImage, fmt.Sprintf(ldapSearchCommandFormat, host), mounts,
volumes, nil, 5*time.Minute)
output, errs := RunOneShotCommandPod(oc, "runonce-ldapsearch-pod", OpenLDAPTestImage, fmt.Sprintf(ldapSearchCommandFormat, host), mounts, volumes, nil, 8*time.Minute)
if len(errs) != 0 {
return output, fmt.Errorf("errours encountered trying to run ldapsearch pod: %v", errs)
}
Expand Down
4 changes: 3 additions & 1 deletion test/extended/util/oauthserver/oauthserver.go
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/RangelReale/osincli"
"github.com/davecgh/go-spew/spew"

corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down Expand Up @@ -203,13 +204,14 @@ func waitForOAuthServerReady(oc *exutil.CLI) error {
}

func waitForOAuthServerPodReady(oc *exutil.CLI) error {
e2e.Logf("Waiting for the OAuth server pod to be ready")
return wait.PollImmediate(1*time.Second, time.Minute, func() (bool, error) {
e2e.Logf("Waiting for the OAuth server pod to be ready")
pod, err := oc.AdminKubeClient().CoreV1().Pods(oc.Namespace()).Get("test-oauth-server", metav1.GetOptions{})
if err != nil {
return false, err
}
if !exutil.CheckPodIsReady(*pod) {
e2e.Logf("OAuth server pod is not ready: %s\nContainer statuses: %s", pod.Status.Message, spew.Sdump(pod.Status.ContainerStatuses))
return false, nil
}
return true, nil
Expand Down

0 comments on commit 99175db

Please sign in to comment.