Skip to content

Conversation

@Duologic
Copy link
Contributor

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.go file has to jump through two hoops. First turning the providerConfig into a map[string]any, this logic is copy/pasta from the Crossplane provider. Second turning the map[string]any into the TF providerConfig. It might be useful to refactor upstream so that this logic is available through pkg/ instead of in internal/.

@Duologic Duologic requested a review from a team October 27, 2025 10:14
Copy link

@suntala suntala left a 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,
Copy link

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?

Copy link
Contributor Author

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.

@Duologic
Copy link
Contributor Author

Duologic commented Nov 8, 2025

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?

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.

2 participants