-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: get clients from TFprovider with xplane providerConfig #15
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
base: main
Are you sure you want to change the base?
Conversation
suntala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we could add some tests (for instance the conversion to providerConfig). This would serve as a form of documentation as well for those new to the repo.
| K6URL: stringValueOrNull(d, "k6_url"), | ||
| K6AccessToken: stringValueOrNull(d, "k6_access_token"), | ||
| StoreDashboardSha256: boolValueOrNull(d, "store_dashboard_sha256"), | ||
| //HTTPHeaders: headers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we please add an explanation about if/when we want to include these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a comment above of this function to explain where this comes from.
|
I see most of the code makes calls to Grafana or cycles through information from Crossplane, it feels like most unit tests would require extensive mocking with little logic left to actually test. Is it okay if we postpone testing work until we've proven this POC? |
This PR introduces logic to get the API clients via the TF provider. This reduces the need to copy all the API init logic. It does require some type casting but other than that it looks fairly straightforward.
The
clients.gofile has to jump through two hoops. First turning theproviderConfiginto amap[string]any, this logic is copy/pasta from the Crossplane provider. Second turning themap[string]anyinto the TFproviderConfig. It might be useful to refactor upstream so that this logic is available throughpkg/instead of ininternal/.