GoogleCloudPlatform / functions-framework-go

FaaS (Function as a service) framework for writing portable Go functions
https://godoc.org/github.com/GoogleCloudPlatform/functions-framework-go
Apache License 2.0
464 stars 63 forks source link

FeatureRequest: Expose cleanup methods #235

Open kostyay opened 7 months ago

kostyay commented 7 months ago

Hi We are using this framework in our unit tests to test Cloud Functions before deployment. Currently no cleanup functions are exposed making it impossible to stop the server once its no longer needed. Furthermore the registry object is not accessible as well so its impossible to unregister already registered functions.

There are only Start and StartHostPort which don't return the server object that can be terminated.

Thanks!

vyacheslav31 commented 4 months ago

Without knowing more about your use case, it's hard to make any conclusive statements, but is there any reason why you can't use httptest package to test your Cloud Functions ? https://pkg.go.dev/net/http/httptest

You just need to invoke a function via http correct?