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

Save and Publish Annotations #6

Closed
wants to merge 3 commits into from
Closed

Conversation

peteclark-ft
Copy link
Contributor

Annotations are now saved to the configured save endpoint prior to being published to UPP. Refactoring resource tests.

@coveralls
Copy link

Coverage Status

Coverage increased (+7.05%) to 64.762% when pulling baec00e on feature/save-to-pac into b716b90 on master.

defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Save to %v returned a %v status code", p.saveEndpoint, resp.StatusCode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful to return the concrete URL in the message rather than the template (p.saveEndpoint) here ?

type Writer interface {
Write(uuid string, tid string, body map[string]interface{}) (map[string]interface{}, error)
GTG() error
Endpoint() string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really useful to have Endpoint() as an exported method here? We could have GTG() return (string,error) instead - I don't think we're implementing an interface here - which would allow us to encapsulate control of the error message.

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 did the same thing for the Publisher interface so kept it consistent - its sole purpose currently is to return a meaningful message during a healthcheck, so yes we could change the interface to return the endpoint and the gtg error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it's not trivial to split these up, as the Endpoint() call is used directly in the healthcheck setup, whereas the GTG is called on invocation - is it fine to leave as is?

@@ -74,16 +74,31 @@ func main() {
EnvVar: "API_YML",
})

saveEndpoint := app.String(cli.StringOpt{
Name: "annotations-save-endpoint",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this have a useful default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you suggest the default should be? It would need to be either a local or test draft-annotations-api endpoint

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that draft-annotations-api world work in k8s everywhere. (Having a default value also helps to clarify whether it should have a protocol on the front or not.)


saveGTGEndpoint := app.String(cli.StringOpt{
Name: "annotations-save-gtg-endpoint",
Desc: "GTG Endpoint for the service which saves PAC annotations (usually draft-annotations-api)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

@coveralls
Copy link

Coverage Status

Coverage increased (+6.8%) to 64.465% when pulling f42b06a on feature/save-to-pac into b716b90 on master.

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.

None yet

3 participants