-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(client): add GetEndpointHost utility getter #347
base: main
Are you sure you want to change the base?
Conversation
f7f29df
to
527116d
Compare
@@ -6,6 +6,8 @@ import "github.com/google/uuid" | |||
// | |||
//nolint:interfacebloat // we'll accept a larger PrefectClient interface | |||
type PrefectClient interface { | |||
GetEndpointHost() string |
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.
todo: add a comment string that differentiates the client factories from a new category of methods like this one
@@ -131,6 +134,23 @@ func testAccCheckWebhookExists(webhookResourceName string, webhook *api.Webhook) | |||
} | |||
} | |||
|
|||
func testAccCheckWebhookEndpoint(webhookResourceName string, webhook *api.Webhook) resource.TestCheckFunc { |
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's worth calling out here, since i couldn't verify this behavior from their docs + only found it through testing the actual control flow
basically, there's a pattern in the testing docs where you can instantiate a pointer outside of the test steps, hydrate it with a custom test function, and then reference it again in the subsequent function
however, the nuance is that these custom functions seem to run well after any pre-built check function on the resource.
object, eg. resource.TestCheckResourceAttr
- so you can't run these resource checks against the hydrated value, because the pointer will still be a zero value
you can, however, perform this check with another custom test function because the value appears to be hydrated at execution time - so that's what we do here
this answers the issue raised here, so closing this PR will resolve #120
resolves https://linear.app/prefect/issue/PLA-841/extract-path-suffix-less-api-endpoint-into-webhook-resource
resolves #333
this PR adds an endpointHost (host only, so no prefix) attribute to the PrefectClient, as well as a getter method on the interface. we use this to construct the full webhook endpoint, since the API only stashes the slug portion, and we'll want to expose a fully formed endpoint based on the API that the provider is initialized with