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

Fix MEMCACHED_SRV support #295

Merged
merged 1 commit into from
Sep 28, 2021

Conversation

petedmarsh
Copy link
Contributor

This did not work in practice due to a mix up of

func example(serverList memcache.ServerList)

and

func example(serverList *memcache.ServerList)

The code used the first case and did not correctly update a given
memcache.ServerList instance, instead a new one was created, updated
then forgot.

This did not work in practice due to a mix up of

    func example(serverList memcache.ServerList)

and

    func example(serverList *memcache.ServerList)

The code used the first case and did not correctly update a given
memcache.ServerList instance, instead a new one was created, updated
then forgot.

Signed-off-by: Peter Marsh <pmarsh@spotify.com>
Copy link
Member

@nezdolik nezdolik left a comment

Choose a reason for hiding this comment

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

this should have ideally been covered by testing

@mattklein123
Copy link
Member

this should have ideally been covered by testing

Agreed. Is there any kind of test we can add to catch this?

@petedmarsh
Copy link
Contributor Author

petedmarsh commented Sep 27, 2021

@nezdolik @mattklein123 I do completely agree with you, this code path is tricky to test as it does DNS lookups and I'm really not sure how to go about writing tests for it (I have fairly limited go experience).

I guess mocking would be the way, if you have any pointers or links that would be useful I can go away and try to add some.

This is currently running in production and does fix the broken code that's currently in main so perhaps it is worth merging? But, genuinely I am happy to write some tests I just need some help :)

Edit:

Possibly a library like this?

https://github.com/foxcpp/go-mockdns

@mattklein123
Copy link
Member

We do have mocking support already used in this library, but I'm not sure exactly the best way to refactor this code to make it mockable. I'm OK merging this for now but if you can try to follow up with testing that would be appreciated. cc @ysawa0 who might have better ideas.

@mattklein123 mattklein123 merged commit ced4263 into envoyproxy:main Sep 28, 2021
timcovar pushed a commit to goatapp/ratelimit that referenced this pull request Jan 16, 2024
This did not work in practice due to a mix up of

    func example(serverList memcache.ServerList)

and

    func example(serverList *memcache.ServerList)

The code used the first case and did not correctly update a given
memcache.ServerList instance, instead a new one was created, updated
then forgot.

Signed-off-by: Peter Marsh <pmarsh@spotify.com>
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.

3 participants