-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add tests for webhook and fix some webhook bugs (#33396) #33442
Conversation
This PR created a mock webhook server in the tests and added integration tests for generic webhooks. It also fixes bugs in package webhooks and pull request comment webhooks.
df2d467
to
6369446
Compare
@@ -480,7 +424,7 @@ type PackagePayload struct { | |||
Action HookPackageAction `json:"action"` | |||
Repository *Repository `json:"repository"` | |||
Package *Package `json:"package"` | |||
Organization *User `json:"organization"` | |||
Organization *Organization `json:"organization"` |
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.
Breaking change?
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 prefer to consider it a bug of the previous implementation, not a feature change. So it's not a break change although it will make something break because the previous implementation is wrong. Compare the two structs,
User
have many fields which should not belong to Organization
, i.e.
// Is the user an administrator
IsAdmin bool `json:"is_admin"`
// swagger:strfmt date-time
LastLogin time.Time `json:"last_login,omitempty"`
// Is user active
IsActive bool `json:"active"`
// Is user login prohibited
ProhibitLogin bool `json:"prohibit_login"`
...
But I'm OK if you prefer to add a breaking
label and description.
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.
Hmm yes, most useful fields are there
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.
But to backport, we need to mention that the struct has changed, to avoid wasting users' time
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.
Not quite understand the details, just approve.
This PR created a mock webhook server in the tests and added integration tests for generic webhooks.
It also fixes bugs in package webhooks and pull request comment webhooks.
This also corrected an error on the package webhook. The previous implementation uses a
User
struct as an organization, now it has been corrected but it will not be consistent with the previous implementation, some fields which not belong to the organization have been removed.Backport #33396
Backport part of #33337