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

Changed code to improve output for files under test/e2e/node #106038

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

NikhilSharmaWe
Copy link
Member

What type of PR is this?

Enhancement

What this PR does / why we need it:

For better (more informative) output for developers when test fails. Changed files are under test/e2e/node for this PR.

Which issue(s) this PR fixes:

Part of #105678

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 1, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @NikhilSharmaWe. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 1, 2021
@ehashman ehashman added this to Triage in SIG Node PR Triage Nov 1, 2021
@NikhilSharmaWe
Copy link
Member Author

@pohly I think the code for output is fine in this case, please confirm. https://github.com/kubernetes/kubernetes/blob/master/test/e2e/node/runtimeclass.go#L62

@@ -360,6 +360,8 @@ func getNpdPodStat(f *framework.Framework, nodeName string) (cpuUsage, rss, work
hasNpdPod = true
break
}
framework.ExpectEqual(hasNpdPod, true)
if !hasNpdPod {
framework.Failf("No node-problem-detector pod is present in %v", summary.Pods)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how the output will look like on failure, curious how %v will format this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was not using any formatting directive in the Failf function an error was shown that Failf needs format directive to run. So, I added %v in this the output statement. I think %v will print list of pods present and no npd pod will be present in that list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was not using any formatting directive in the Failf function an error was shown that Failf needs format directive to run. So, I added %v in this the output statement. I think %v will print list of pods present and no npd pod will be present in that list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not %+q? Also the structure will be huge, this is why I wonder how it will look like and whether it will be readable at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I am unable to figure out how to see the output which function throws if condition follows, can you help me to know how it can be done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a short test program:

package main

import (
	"fmt"

	"k8s.io/kubelet/pkg/apis/stats/v1alpha1"
)

func main() {
	summary := v1alpha1.Summary{}
	for i := 0; i < 10; i++ {
		summary.Pods = append(summary.Pods, v1alpha1.PodStats{
			PodRef: v1alpha1.PodReference{
				Name: fmt.Sprintf("pod-%d", i),
			},
		})
	}
	fmt.Printf("%v", summary.Pods)
}

I can't be run in the Go playground (downloading the imports times out), otherwise I would link to that.

It prints:

[{{pod-0  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-1  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-2  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-3  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-4  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-5  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-6  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-7  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-8  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>} {{pod-9  } 0001-01-01 00:00:00 +0000 UTC [] <nil> <nil> <nil> [] <nil> <nil>}]

It's a bit better with %+v:

[{PodRef:{Name:pod-0 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-1 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-2 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-3 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-4 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-5 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-6 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-7 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-8 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>} {PodRef:{Name:pod-9 Namespace: UID:} StartTime:0001-01-01 00:00:00 +0000 UTC Containers:[] CPU:<nil> Memory:<nil> Network:<nil> VolumeStats:[] EphemeralStorage:<nil> ProcessStats:<nil>}]

Not particularly readable, but IMHO still better than nothing. I don't think a helper function that extracts just the names is justified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NikhilSharmaWe can you please change the formatter to %+v. @pohly thank you for providing an easy way to validate this change!

@SergeyKanzhelev SergeyKanzhelev moved this from Triage to PRs Waiting on Author in SIG Node CI/Test Board Nov 3, 2021
@SergeyKanzhelev
Copy link
Member

/test

@k8s-ci-robot
Copy link
Contributor

@SergeyKanzhelev: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test pull-kubernetes-conformance-kind-ga-only-parallel
  • /test pull-kubernetes-dependencies
  • /test pull-kubernetes-dependencies-go-canary
  • /test pull-kubernetes-e2e-gce
  • /test pull-kubernetes-e2e-gce-100-performance
  • /test pull-kubernetes-e2e-gce-big-performance
  • /test pull-kubernetes-e2e-gce-canary
  • /test pull-kubernetes-e2e-gce-large-performance
  • /test pull-kubernetes-e2e-gce-large-performance-canary
  • /test pull-kubernetes-e2e-gce-network-proxy-http-connect
  • /test pull-kubernetes-e2e-gce-no-stage
  • /test pull-kubernetes-e2e-gce-ubuntu
  • /test pull-kubernetes-e2e-gce-ubuntu-containerd
  • /test pull-kubernetes-e2e-gce-ubuntu-containerd-canary
  • /test pull-kubernetes-e2e-kind
  • /test pull-kubernetes-e2e-kind-ipv6
  • /test pull-kubernetes-files-remake
  • /test pull-kubernetes-integration
  • /test pull-kubernetes-integration-go-canary
  • /test pull-kubernetes-kubemark-e2e-gce-scale
  • /test pull-kubernetes-node-e2e-alpha
  • /test pull-kubernetes-node-e2e-containerd
  • /test pull-kubernetes-typecheck
  • /test pull-kubernetes-unit
  • /test pull-kubernetes-unit-go-canary
  • /test pull-kubernetes-verify
  • /test pull-kubernetes-verify-go-canary
  • /test pull-kubernetes-verify-govet-levee

The following commands are available to trigger optional jobs:

  • /test check-dependency-stats
  • /test pull-kubernetes-conformance-image-test
  • /test pull-kubernetes-conformance-kind-ga-only
  • /test pull-kubernetes-conformance-kind-ipv6-parallel
  • /test pull-kubernetes-cross
  • /test pull-kubernetes-e2e-aks-engine-azure-disk-windows-containerd
  • /test pull-kubernetes-e2e-aks-engine-azure-disk-windows-dockershim
  • /test pull-kubernetes-e2e-aks-engine-azure-file-windows-containerd
  • /test pull-kubernetes-e2e-aks-engine-azure-file-windows-dockershim
  • /test pull-kubernetes-e2e-aks-engine-gpu-windows-dockershim
  • /test pull-kubernetes-e2e-aks-engine-windows-containerd
  • /test pull-kubernetes-e2e-aks-engine-windows-dockershim
  • /test pull-kubernetes-e2e-capz-azure-disk
  • /test pull-kubernetes-e2e-capz-azure-disk-vmss
  • /test pull-kubernetes-e2e-capz-azure-file
  • /test pull-kubernetes-e2e-capz-azure-file-vmss
  • /test pull-kubernetes-e2e-capz-conformance
  • /test pull-kubernetes-e2e-capz-ha-control-plane
  • /test pull-kubernetes-e2e-capz-windows-dockershim
  • /test pull-kubernetes-e2e-containerd-gce
  • /test pull-kubernetes-e2e-gce-alpha-features
  • /test pull-kubernetes-e2e-gce-correctness
  • /test pull-kubernetes-e2e-gce-csi-serial
  • /test pull-kubernetes-e2e-gce-device-plugin-gpu
  • /test pull-kubernetes-e2e-gce-iscsi
  • /test pull-kubernetes-e2e-gce-iscsi-serial
  • /test pull-kubernetes-e2e-gce-kubetest2
  • /test pull-kubernetes-e2e-gce-network-proxy-grpc
  • /test pull-kubernetes-e2e-gce-storage-disruptive
  • /test pull-kubernetes-e2e-gce-storage-slow
  • /test pull-kubernetes-e2e-gce-storage-snapshot
  • /test pull-kubernetes-e2e-gci-gce-autoscaling
  • /test pull-kubernetes-e2e-gci-gce-ingress
  • /test pull-kubernetes-e2e-gci-gce-ipvs
  • /test pull-kubernetes-e2e-iptables-azure-dualstack
  • /test pull-kubernetes-e2e-ipvs-azure-dualstack
  • /test pull-kubernetes-e2e-kind-canary
  • /test pull-kubernetes-e2e-kind-dual-canary
  • /test pull-kubernetes-e2e-kind-ipv6-canary
  • /test pull-kubernetes-e2e-kind-ipvs-dual-canary
  • /test pull-kubernetes-e2e-kops-aws
  • /test pull-kubernetes-e2e-ubuntu-gce-network-policies
  • /test pull-kubernetes-e2e-windows-gce
  • /test pull-kubernetes-kubemark-e2e-gce-big
  • /test pull-kubernetes-local-e2e
  • /test pull-kubernetes-node-crio-cgrpv2-e2e
  • /test pull-kubernetes-node-crio-e2e
  • /test pull-kubernetes-node-e2e
  • /test pull-kubernetes-node-e2e-alpha-kubetest2
  • /test pull-kubernetes-node-e2e-containerd-features
  • /test pull-kubernetes-node-e2e-containerd-features-kubetest2
  • /test pull-kubernetes-node-e2e-containerd-kubetest2
  • /test pull-kubernetes-node-e2e-kubetest2
  • /test pull-kubernetes-node-e2e-podutil
  • /test pull-kubernetes-node-kubelet-eviction
  • /test pull-kubernetes-node-kubelet-eviction-kubetest2
  • /test pull-kubernetes-node-kubelet-serial
  • /test pull-kubernetes-node-kubelet-serial-containerd
  • /test pull-kubernetes-node-kubelet-serial-containerd-kubetest2
  • /test pull-kubernetes-node-kubelet-serial-cpu-manager
  • /test pull-kubernetes-node-kubelet-serial-crio-cgroupv1
  • /test pull-kubernetes-node-kubelet-serial-crio-cgroupv2
  • /test pull-kubernetes-node-kubelet-serial-hugepages
  • /test pull-kubernetes-node-kubelet-serial-kubetest2
  • /test pull-kubernetes-node-kubelet-serial-memory-manager
  • /test pull-kubernetes-node-kubelet-serial-topology-manager
  • /test pull-kubernetes-node-memoryqos-cgrpv2
  • /test pull-kubernetes-node-swap-fedora
  • /test pull-kubernetes-node-swap-ubuntu
  • /test pull-kubernetes-unit-experimental
  • /test pull-publishing-bot-validate

Use /test all to run the following jobs that were automatically triggered:

  • pull-kubernetes-conformance-kind-ga-only-parallel
  • pull-kubernetes-conformance-kind-ipv6-parallel
  • pull-kubernetes-dependencies
  • pull-kubernetes-e2e-gce-100-performance
  • pull-kubernetes-e2e-gce-ubuntu-containerd
  • pull-kubernetes-e2e-kind
  • pull-kubernetes-e2e-kind-ipv6
  • pull-kubernetes-integration
  • pull-kubernetes-node-e2e-containerd
  • pull-kubernetes-typecheck
  • pull-kubernetes-unit
  • pull-kubernetes-verify
  • pull-kubernetes-verify-govet-levee

In response to this:

/test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@SergeyKanzhelev
Copy link
Member

/test

hm, I don't think this test may run on PR, it only runs here: https://testgrid.k8s.io/sig-node-node-problem-detector#ci-npd-e2e-kubernetes-gce-gci so the easiest way to test it is to run this test locally. The idea of the PR is right. My only concern is the size and formatting of the proposed output. Perhaps just keeping pod names would be sufficient.

@NikhilSharmaWe
Copy link
Member Author

NikhilSharmaWe commented Nov 4, 2021

/test

hm, I don't think this test may run on PR, it only runs here: https://testgrid.k8s.io/sig-node-node-problem-detector#ci-npd-e2e-kubernetes-gce-gci so the easiest way to test it is to run this test locally. The idea of the PR is right. My only concern is the size and formatting of the proposed output. Perhaps just keeping pod names would be sufficient.

Could you please explain what changes the PR needs exactly.

@pohly
Copy link
Contributor

pohly commented Nov 4, 2021

Looks good to me, but I'll let @SergeyKanzhelev decide whether he wants this as failure output.

@NikhilSharmaWe
Copy link
Member Author

@SergeyKanzhelev did that (changed %v to %+v) already.

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@SergeyKanzhelev
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 4, 2021
@SergeyKanzhelev
Copy link
Member

/triage accepted
/priority backlog

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 4, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: NikhilSharmaWe, SergeyKanzhelev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 4, 2021
@SergeyKanzhelev
Copy link
Member

/kind cleanup

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Nov 4, 2021
@pohly
Copy link
Contributor

pohly commented Nov 4, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 4, 2021
@k8s-ci-robot k8s-ci-robot merged commit 508e679 into kubernetes:master Nov 4, 2021
SIG Node CI/Test Board automation moved this from PRs Waiting on Author to Done Nov 4, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Nov 4, 2021
@NikhilSharmaWe
Copy link
Member Author

@SergeyKanzhelev could you please sponsor my application to become a member of Kubernetes org.

@SergeyKanzhelev
Copy link
Member

@SergeyKanzhelev could you please sponsor my application to become a member of Kubernetes org.

Looked at a few of your merged PRs, looks good, I can support. Please keep up the good work and expand the scope of contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants