Skip to content

Commit

Permalink
[release-0.1] Update debug e2e (istio-ecosystem#215)
Browse files Browse the repository at this point in the history
* Add debug information

Signed-off-by: frherrer <frherrer@redhat.com>

* Increase timeout on e2e

Signed-off-by: frherrer <frherrer@redhat.com>

---------

Signed-off-by: frherrer <frherrer@redhat.com>
Co-authored-by: frherrer <frherrer@redhat.com>
  • Loading branch information
istio-testing and fjglira authored Jul 18, 2024
1 parent e3fe2bb commit 9b9be64
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/controlplane/control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import (
var istiodVersionRegex = regexp.MustCompile(`Version:"(\d+\.\d+(\.\d+|-\w+))`)

var _ = Describe("Control Plane Installation", Ordered, func() {
SetDefaultEventuallyTimeout(120 * time.Second)
SetDefaultEventuallyTimeout(180 * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)

debugInfoLogged := false
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/operator/operator_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var sailCRDs = []string{
}

var _ = Describe("Operator", Ordered, func() {
SetDefaultEventuallyTimeout(120 * time.Second)
SetDefaultEventuallyTimeout(180 * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)

Describe("installation", func() {
Expand Down
14 changes: 14 additions & 0 deletions tests/e2e/util/common/e2e_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ func logOperatorDebugInfo() {

events, err := kubectl.GetEvents(namespace)
logDebugElement("Events in "+namespace, events, err)

// Temporaty information to gather more details about failure
pods, err := kubectl.GetPods(namespace, "-o wide")
logDebugElement("Pods in "+namespace, pods, err)

describe, err := kubectl.Describe(namespace, "deployment", deploymentName)
logDebugElement("Operator Deployment describe", describe, err)
}

func logIstioDebugInfo() {
Expand All @@ -130,6 +137,13 @@ func logCNIDebugInfo() {

events, err := kubectl.GetEvents(istioCniNamespace)
logDebugElement("Events in "+istioCniNamespace, events, err)

// Temporaty information to gather more details about failure
pods, err := kubectl.GetPods(istioCniNamespace, "-o wide")
logDebugElement("Pods in "+istioCniNamespace, pods, err)

describe, err := kubectl.Describe(istioCniNamespace, "daemonset", "istio-cni-node")
logDebugElement("Istio CNI DaemonSet describe", describe, err)
}

func logDebugElement(caption string, info string, err error) {
Expand Down
15 changes: 15 additions & 0 deletions tests/e2e/util/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ func GetEvents(ns string) (string, error) {
return output, nil
}

// Describe returns the description of a resource
// Arguments:
// - ns: namespace
// - kind: type of the resource
// - name: name of the resource
func Describe(ns, kind, name string) (string, error) {
cmd := kubectl("describe %s %s %s", kind, name, nsflag(ns))
output, err := shell.ExecuteCommand(cmd)
if err != nil {
return "", fmt.Errorf("error describing resource: %w, output: %s", err, output)
}

return output, nil
}

// Logs returns the logs of a deployment
// Arguments:
// - ns: namespace
Expand Down

0 comments on commit 9b9be64

Please sign in to comment.