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
test: Avoid panics due to dereferencing a nil error #10390
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set 'CmdRes.err' to a non-nil value when command is not successful. Also avoid calling 'Error()' on an error explicitly, so that no panics are caused when the error is 'nil'. This avoids test failures like this: STEP: Deleting namespace 2020022720301k8spolicytestclusterwidepoliciestestclusterwidecon ! Panic in Spec Setup (BeforeEach) [38.899 seconds] K8sPolicyTest /Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:395 Clusterwide policies /Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:395 Test clusterwide connectivity with policies [BeforeEach] /Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:430 Test Panicked runtime error: invalid memory address or nil pointer dereference /Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:374 Full Stack Trace github.com/cilium/cilium/test/ginkgo-ext.BeforeEach.func1.1(0xc000448900) /Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:374 +0x5e panic(0x26993c0, 0x3ba0bd0) /usr/local/Cellar/go/1.13.8/libexec/src/runtime/panic.go:679 +0x1b2 github.com/cilium/cilium/test/helpers.(*Kubectl).NamespaceDelete(0xc000384e40, 0xc000811aa0, 0x3f, 0x2) /Users/jarno/go/src/github.com/cilium/cilium/test/helpers/kubectl.go:859 +0x2eb github.com/cilium/cilium/test/k8sT.glob..func7.11.1() /Users/jarno/go/src/github.com/cilium/cilium/test/k8sT/Policies.go:1375 +0x5b1 github.com/cilium/cilium/test/ginkgo-ext.BeforeEach.func1() Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
jrajahalme
added
pending-review
kind/bug/CI
This is a bug in the testing code.
release-note/minor
This PR changes functionality that users may find relevant to operating Cilium.
labels
Feb 28, 2020
test-me-please |
nebril
approved these changes
Mar 4, 2020
@jrajahalme and @nebril This PR is marked as needing a backport to 1.7. However, this patch does not apply to the v1.7 branch. It seems to depend on ae9619a (which was not backported). What's the verdict? Do we need to backport the other commit first, or does this commit not need a backport. |
Seems like backporting to 1.7 is not needed here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind/bug/CI
This is a bug in the testing code.
release-note/minor
This PR changes functionality that users may find relevant to operating Cilium.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Set 'CmdRes.err' to a non-nil value when command is not
successful. Also avoid calling 'Error()' on an error explicitly, so
that no panics are caused when the error is 'nil'.
This avoids test failures like this:
STEP: Deleting namespace 2020022720301k8spolicytestclusterwidepoliciestestclusterwidecon
! Panic in Spec Setup (BeforeEach) [38.899 seconds]
K8sPolicyTest
/Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:395
Clusterwide policies
/Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:395
Test clusterwide connectivity with policies [BeforeEach]
/Users/jarno/go/src/github.com/cilium/cilium/test/ginkgo-ext/scopes.go:430
Signed-off-by: Jarno Rajahalme jarno@covalent.io
This change is