This is an automated email from the ASF dual-hosted git repository.

gfournier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 6c93e7efa chore(ci): Dump some cluster infos
6c93e7efa is described below

commit 6c93e7efabda1524870bd471b7667b062e630a84
Author: Gaelle Fournier <gaelle.fournier.w...@gmail.com>
AuthorDate: Thu Jul 18 16:13:53 2024 +0200

    chore(ci): Dump some cluster infos
---
 e2e/support/test_support.go |  3 +++
 e2e/support/util/dump.go    | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 2527942d5..4bef76677 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -2920,6 +2920,9 @@ func DumpNamespace(t *testing.T, ctx context.Context, ns 
string) {
                if err := util.Dump(ctx, TestClient(t), ns, t); err != nil {
                        t.Logf("Error while dumping namespace %s: %v\n", ns, 
err)
                }
+               if err := util.DumpClusterState(ctx, TestClient(t), ns, t); err 
!= nil {
+                       t.Logf("Error while dumping cluster state: %v\n", err)
+               }
        }
 }
 
diff --git a/e2e/support/util/dump.go b/e2e/support/util/dump.go
index 75b144db2..a2e18c213 100644
--- a/e2e/support/util/dump.go
+++ b/e2e/support/util/dump.go
@@ -45,6 +45,33 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/openshift"
 )
 
+// DumpClusterState prints informations about the cluster state
+func DumpClusterState(ctx context.Context, c client.Client, ns string, t 
*testing.T) error {
+       t.Logf("-------------------- start dumping cluster state 
--------------------\n")
+
+       nodes, err := c.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
+       if err != nil {
+               return err
+       }
+
+       for _, node := range nodes.Items {
+               nodeReady := false
+               nodeConditions := node.Status.Conditions
+               for _, condition := range nodeConditions {
+                       if condition.Type == corev1.NodeReady && 
condition.Status == corev1.ConditionTrue {
+                               nodeReady = true
+                       }
+               }
+               t.Logf("node: Name='%s', Ready='%t'", node.ObjectMeta.Name, 
nodeReady)
+               if node.Spec.Taints != nil {
+                       t.Logf("node taints: Taints='%s'", node.Spec.Taints)
+               }
+       }
+
+       t.Logf("-------------------- dumping cluster state 
--------------------\n")
+       return nil
+}
+
 // Dump prints all information about the given namespace to debug errors
 func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error 
{
        t.Logf("-------------------- start dumping namespace %s 
--------------------\n", ns)

Reply via email to