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

Make zone sync struct optional #22

Merged
merged 1 commit into from
Jun 7, 2019
Merged

Make zone sync struct optional #22

merged 1 commit into from
Jun 7, 2019

Conversation

Rulox
Copy link

@Rulox Rulox commented Jun 5, 2019

Proposed changes

NGINX Plus does not return StreamZoneSync metrics if there is no sync zone configured. Because of this, we need to make these a pointer to the struct so we can check if the metrics are present or not (instead of returning an empty struct with zeroes)

This will require the user to be careful when using the Stats.StreamZoneSync field, as it can be nil.

@Rulox Rulox added the bug An issue reporting a potential bug label Jun 5, 2019
@Rulox Rulox requested a review from pleshakov June 5, 2019 11:28
@Rulox Rulox self-assigned this Jun 5, 2019
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

@Rulox looks good!

small comment: do we need to change the tests https://github.com/nginxinc/nginx-plus-go-client/blob/master/tests/client_test.go#L770 and https://github.com/nginxinc/nginx-plus-go-client/blob/master/tests/client_test.go#L806 so that we check if StreamZoneSync is not nil and fail if it is?

@Rulox
Copy link
Author

Rulox commented Jun 7, 2019

Yes we can add those. That will never happen, the test will fail anyways because the struct is nil. Again this will never happens unless we change the nginx configuration. I'll add the checks for a better error message tho 👍

@Rulox Rulox merged commit bb9e3de into master Jun 7, 2019
@Rulox Rulox deleted the fix-zone-sync branch June 7, 2019 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue reporting a potential bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants