Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
Signed-off-by: xuezhaojun <zxue@redhat.com>
  • Loading branch information
xuezhaojun committed Oct 23, 2024
1 parent 7232ee2 commit c1c95ce
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ func checkAddonStatus() {
return err
}
if d.Status.AvailableReplicas < 1 {
podlist, err := kubeClient.CoreV1().Pods(hubInstallNamespace).List(context.Background(), metav1.ListOptions{})
if err != nil {
return err
}
fmt.Println("podlist on hub:")
for _, pod := range podlist.Items {
fmt.Println(pod.Name)
}
return fmt.Errorf("available replicas for %s should >= 1, but get %d", deployment, d.Status.AvailableReplicas)
}
}
Expand All @@ -126,7 +134,23 @@ func checkAddonStatus() {
// deployment on managedcluster is running
anpAgent, err := kubeClient.AppsV1().Deployments(managedClusterInstallNamespace).Get(context.Background(), "cluster-proxy-proxy-agent", metav1.GetOptions{})
if err != nil {
return err
// log pod log of cluster-proxy-addon-manager
podlist, err := kubeClient.CoreV1().Pods(hubInstallNamespace).List(context.Background(), metav1.ListOptions{})
if err != nil {
return err
}
podlog := ""
for _, pod := range podlist.Items {
if strings.Contains(pod.Name, "cluster-proxy-addon-manager") {
podLog, err := kubeClient.CoreV1().Pods(hubInstallNamespace).GetLogs(pod.Name, &corev1.PodLogOptions{}).DoRaw(context.Background())
if err != nil {
return err
}
podlog += string(podLog)
}
}
fmt.Println("cluster-proxy-addon-manager podlog: ", podlog)
return fmt.Errorf("deployment %s is not running, %v", "cluster-proxy-proxy-agent", err)
}
if anpAgent.Status.AvailableReplicas < 1 {
return fmt.Errorf("available replicas for %s should be more than 1, but get %d", "anp-agent", anpAgent.Status.AvailableReplicas)
Expand Down

0 comments on commit c1c95ce

Please sign in to comment.