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

test: nil pointer in metrics test #972

Merged
merged 1 commit into from Jun 4, 2021
Merged

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Jun 1, 2021

Apparently resp.Body can be nil even when there was no error code:

/mnt/workspace/pmem-csi_devel/test/e2e/metrics/metrics.go:50
Test Panicked
/go/src/runtime/panic.go:212
Panic: runtime error: invalid memory address or nil pointer dereference
Full stack:
github.com/intel/pmem-csi/test/e2e/metrics.glob..func1.2.1()
	/mnt/workspace/pmem-csi_devel/test/e2e/metrics/metrics.go:81
        +0x7f0

That's the line with ioutil.ReadAll(resp.Body).

An assertion failure gets caught, a panic isn't, therefore Expect()
deals with this problem.

Fixes: #971

Apparently resp.Body can be nil even when there was no error code:

/mnt/workspace/pmem-csi_devel/test/e2e/metrics/metrics.go:50
Test Panicked
/go/src/runtime/panic.go:212
Panic: runtime error: invalid memory address or nil pointer dereference
Full stack:
github.com/intel/pmem-csi/test/e2e/metrics.glob..func1.2.1()
	/mnt/workspace/pmem-csi_devel/test/e2e/metrics/metrics.go:81
        +0x7f0

That's the line with ioutil.ReadAll(resp.Body).

An assertion failure gets caught, a panic isn't, therefore Expect()
deals with this problem.
@pohly pohly requested a review from okartau June 1, 2021 09:31
@pohly pohly merged commit c28ba6a into intel:devel Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test flake: invalid memory address in metrics test
2 participants