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: ParseVcapServices stops searching after the first service offering #1116

Merged

Conversation

jameshochadel
Copy link
Contributor

The for loop on L103 was written to return after the checking the first entry in vcapMap, regardless of whether findMySQLTag found a suitable service or returned an error. If services from multiple service offerings are bound to the application and the service tagged with "mysql" is not in the first offering, the function will not find it. The new test case fails when run against the unmodified code.

To fix this, flatten the map[string][]VcapService into a []VCapService, and pass the flat slice to findMySQLTag.

Checklist:

  • Have you added or updated tests to validate the changed functionality?
  • Have you added Release Notes in the docs repositories?
  • Have you followed the Conventional Commits specification?

The for loop on L103 was written to return after the checking the first entry in vcapMap, regardless of whether findMySQLTag found a suitable service or returned an error. If services from multiple service offerings are bound to the application and the service tagged with "mysql" is not in the first offering, the function will not find it. The new test case fails when run against the unmodified code.

To fix this, flatten the map[string][]VcapService into a []VCapService, and pass the flat slice to findMySQLTag.
@jameshochadel jameshochadel force-pushed the fix-parsing-vcap-services branch from 3c32520 to 4c24892 Compare October 8, 2024 17:22
@ifindlay-cci ifindlay-cci merged commit f0a172c into cloudfoundry:main Oct 9, 2024
8 checks passed
@jameshochadel jameshochadel deleted the fix-parsing-vcap-services branch October 10, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants