Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Fixed pointer bug in ListProbes() method in serviceimpl.go and the corresponding test. #459

Closed

Conversation

evanSpendlove
Copy link

There is a pointer issue in the ListProbes() RPC. The ListProbesResponse object contains a list of structs, each containing a string and ProbeInfo object. If there are multiple probes added, the strings will all be the same as the last item added to this list.

Example:
3 probes (probe0, probe1, probe2) are added.
ListProbes() is called.

Desired Response: ["probe0" , "probe1" , "probe2" ]
Received Response: ["probe2" , "probe2" , "probe2" ]

There is also a minor bug in the serviceimpl_test.go file.

if reflect.DeepEqual(respProbeNames, testProbes) {
t.Errorf("Probes in ListProbes() response: %v, expected: %s", respProbeNames, testProbes)
}

There is a missing negation (!) in the if statement above, it should be:

if !reflect.DeepEqual(respProbeNames, testProbes) {
		t.Errorf("Probes in ListProbes() response: %v, expected: %s", respProbeNames, testProbes)
	}

Without the negation, this will only throw an error when these are the same, rather than different.

This pull request addresses both of these issues.

Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

Thanks for finding the bug, and the fix. One suggestion.

prober/serviceimpl.go Show resolved Hide resolved
@manugarg
Copy link
Contributor

manugarg commented Sep 8, 2020

Submitted this change (baf6337) through #461.

@manugarg manugarg closed this Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants