Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report logs when checkPods is going to fail #88

Merged
Merged
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
4 changes: 2 additions & 2 deletions test/integration/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestOptOutOptIn(t *testing.T) {
resourceVersion := latestSecret.GetResourceVersion()
pullSecret.SetResourceVersion(resourceVersion) // need to update the version, otherwise operation is not permitted

errConfig := wait.PollImmediate(5*time.Second, 5*time.Minute, func() (bool, error) {
errConfig := wait.PollImmediate(5*time.Second, 10*time.Minute, func() (bool, error) {
objs := map[string]interface{}{}
errUnmarshals := json.Unmarshal([]byte(pullSecret.Data[".dockerconfigjson"]), &objs)
if errUnmarshals != nil {
Expand All @@ -79,7 +79,7 @@ func TestOptOutOptIn(t *testing.T) {

// Check if reports are uploaded - Logs show that insights-operator is enabled and reports are uploaded
restartInsightsOperator(t)
errDisabled := wait.PollImmediate(1*time.Second, 10*time.Minute, func() (bool, error) {
errDisabled := wait.PollImmediate(1*time.Second, 20*time.Minute, func() (bool, error) {
insightsDisabled := isOperatorDisabled(t, clusterOperatorInsights())
if insightsDisabled {
return false, nil
Expand Down
2 changes: 1 addition & 1 deletion test/integration/bugs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestUnreachableHost(t *testing.T) {
t.Fatal(err.Error())
}
// Check the operator is not degraded anymore
errDegraded := wait.PollImmediate(1*time.Second, 10*time.Minute, func() (bool, error) {
errDegraded := wait.PollImmediate(1*time.Second, 20*time.Minute, func() (bool, error) {
insightsDegraded := isOperatorDegraded(t, clusterOperatorInsights())
if insightsDegraded {
return false, nil
Expand Down
7 changes: 4 additions & 3 deletions test/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func restartInsightsOperator(t *testing.T) {

for _, pod := range pods.Items {
clientset.CoreV1().Pods("openshift-insights").Delete(pod.Name, &metav1.DeleteOptions{})
err := wait.PollImmediate(1*time.Second, 10*time.Minute, func() (bool, error) {
err := wait.PollImmediate(1*time.Second, 20*time.Minute, func() (bool, error) {
_, err := clientset.CoreV1().Pods("openshift-insights").Get(pod.Name, metav1.GetOptions{})
if err == nil {
t.Logf("the pod is not yet deleted: %v\n", err)
Expand Down Expand Up @@ -150,7 +150,7 @@ func checkPodsLogs(t *testing.T, kubeClient *kubernetes.Clientset, message strin
panic(err.Error())
}

errLog := wait.PollImmediate(5*time.Second, 15*time.Minute, func() (bool, error) {
errLog := wait.PollImmediate(5*time.Second, 30*time.Minute, func() (bool, error) {
req := kubeClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &corev1.PodLogOptions{})
podLogs, err := req.Stream()
if err != nil {
Expand All @@ -168,6 +168,7 @@ func checkPodsLogs(t *testing.T, kubeClient *kubernetes.Clientset, message strin
result := strings.Contains(log, message)
if result == false {
t.Logf("No %s in logs\n", message)
t.Logf("Logs for verification: ****\n%s", log)
return false, nil
}

Expand All @@ -193,7 +194,7 @@ func TestMain(m *testing.M) {
func waitForOperator(kubeClient *kubernetes.Clientset) error {
depClient := kubeClient.AppsV1().Deployments("openshift-insights")

err := wait.PollImmediate(1*time.Second, 10*time.Minute, func() (bool, error) {
err := wait.PollImmediate(1*time.Second, 20*time.Minute, func() (bool, error) {
_, err := depClient.Get("insights-operator", metav1.GetOptions{})
if err != nil {
fmt.Printf("error waiting for operator deployment to exist: %v\n", err)
Expand Down