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: add nil checks #104

Merged
merged 2 commits into from
Oct 11, 2023
Merged

Conversation

bhshkh
Copy link
Collaborator

@bhshkh bhshkh commented Oct 7, 2023

Without these nil checks, the test panics and further tests are not run. E.g.:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x150ed49]

goroutine 93 [running]:
testing.tRunner.func1.2({0x15a7020, 0x1ad7d40})
	/usr/local/go/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1529 +0x39f
panic({0x15a7020, 0x1ad7d40})
	/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/googleapis/cloud-bigtable-clients-test/tests.TestCheckAndMutateRow_Generic_CloseClient(0xc00041c000)
	*****************************/cloud-bigtable-clients-test/tests/checkandmutaterow_test.go:299 +0x669
testing.tRunner(0xc00041c000, 0x16990d0)
	/usr/local/go/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1629 +0x3ea
exit status 2

@@ -296,6 +297,10 @@ func TestCheckAndMutateRow_Generic_CloseClient(t *testing.T) {
// 4b. Check that all the batch-one requests succeeded
checkResultOkStatus(t, resultsBatchOne...)
for i := 0; i < halfBatchSize; i++ {
assert.NotNil(t, resultsBatchOne[i].Result)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are other *_test.go files that may need this too. You may apply it to all of them for consistency?

@bhshkh bhshkh merged commit e937e4a into googleapis:main Oct 11, 2023
3 checks passed
@bhshkh bhshkh deleted the tests/nil-check-proxy-tests branch October 11, 2023 04:07
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.

None yet

2 participants