@@ -24,7 +24,7 @@ import (
2424//
2525//
2626const (
27- port = 3010
27+ port = 3009
2828 path = "/webhooks"
2929)
3030
@@ -42,7 +42,7 @@ func TestMain(m *testing.M) {
4242 hook .RegisterEvents (HandlePayload , RepoPushEvent , RepoForkEvent , RepoCommitCommentCreatedEvent , RepoCommitStatusCreatedEvent , RepoCommitStatusUpdatedEvent , IssueCreatedEvent , IssueUpdatedEvent , IssueCommentCreatedEvent , PullRequestCreatedEvent , PullRequestUpdatedEvent , PullRequestApprovedEvent , PullRequestApprovalRemovedEvent , PullRequestMergedEvent , PullRequestDeclinedEvent , PullRequestCommentCreatedEvent , PullRequestCommentUpdatedEvent , PullRequestCommentDeletedEvent )
4343
4444 go webhooks .Run (hook , "127.0.0.1:" + strconv .Itoa (port ), path )
45- time .Sleep (5000 )
45+ time .Sleep (time . Millisecond * 500 )
4646
4747 os .Exit (m .Run ())
4848
@@ -56,7 +56,7 @@ func TestProvider(t *testing.T) {
5656func TestUUIDMissingEvent (t * testing.T ) {
5757 payload := "{}"
5858
59- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
59+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
6060 req .Header .Set ("Content-Type" , "application/json" )
6161 req .Header .Set ("X-Event-Key" , "noneexistant_event" )
6262
@@ -74,7 +74,7 @@ func TestUUIDMissingEvent(t *testing.T) {
7474func TestUUIDDoesNotMatchEvent (t * testing.T ) {
7575 payload := "{}"
7676
77- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
77+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
7878 req .Header .Set ("Content-Type" , "application/json" )
7979 req .Header .Set ("X-Hook-UUID" , "THIS_DOES_NOT_MATCH" )
8080
@@ -92,7 +92,7 @@ func TestUUIDDoesNotMatchEvent(t *testing.T) {
9292func TestBadNoEventHeader (t * testing.T ) {
9393 payload := "{}"
9494
95- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
95+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
9696 req .Header .Set ("Content-Type" , "application/json" )
9797 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
9898
@@ -110,7 +110,7 @@ func TestBadNoEventHeader(t *testing.T) {
110110func TestUnsubscribedEvent (t * testing.T ) {
111111 payload := "{}"
112112
113- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
113+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
114114 req .Header .Set ("Content-Type" , "application/json" )
115115 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
116116 req .Header .Set ("X-Event-Key" , "noneexistant_event" )
@@ -129,7 +129,7 @@ func TestUnsubscribedEvent(t *testing.T) {
129129func TestBadBody (t * testing.T ) {
130130 payload := ""
131131
132- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
132+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
133133 req .Header .Set ("Content-Type" , "application/json" )
134134 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
135135 req .Header .Set ("X-Event-Key" , "repo:push" )
@@ -355,7 +355,7 @@ func TestRepoPush(t *testing.T) {
355355}
356356`
357357
358- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
358+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
359359 req .Header .Set ("Content-Type" , "application/json" )
360360 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
361361 req .Header .Set ("X-Event-Key" , "repo:push" )
@@ -429,7 +429,7 @@ func TestRepoFork(t *testing.T) {
429429}
430430`
431431
432- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
432+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
433433 req .Header .Set ("Content-Type" , "application/json" )
434434 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
435435 req .Header .Set ("X-Event-Key" , "repo:fork" )
@@ -514,7 +514,7 @@ func TestRepoCommitCommentCreated(t *testing.T) {
514514}
515515`
516516
517- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
517+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
518518 req .Header .Set ("Content-Type" , "application/json" )
519519 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
520520 req .Header .Set ("X-Event-Key" , "repo:commit_comment_created" )
@@ -588,7 +588,7 @@ func TestRepoCommitStatusCreated(t *testing.T) {
588588}
589589`
590590
591- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
591+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
592592 req .Header .Set ("Content-Type" , "application/json" )
593593 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
594594 req .Header .Set ("X-Event-Key" , "repo:commit_status_created" )
@@ -662,7 +662,7 @@ func TestRepoCommitStatusUpdated(t *testing.T) {
662662}
663663`
664664
665- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
665+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
666666 req .Header .Set ("Content-Type" , "application/json" )
667667 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
668668 req .Header .Set ("X-Event-Key" , "repo:commit_status_updated" )
@@ -747,7 +747,7 @@ func TestIssueCreated(t *testing.T) {
747747}
748748`
749749
750- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
750+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
751751 req .Header .Set ("Content-Type" , "application/json" )
752752 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
753753 req .Header .Set ("X-Event-Key" , "issue:created" )
@@ -864,7 +864,7 @@ func TestIssueUpdated(t *testing.T) {
864864}
865865`
866866
867- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
867+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
868868 req .Header .Set ("Content-Type" , "application/json" )
869869 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
870870 req .Header .Set ("X-Event-Key" , "issue:updated" )
@@ -975,7 +975,7 @@ func TestIssueCommentCreated(t *testing.T) {
975975}
976976`
977977
978- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
978+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
979979 req .Header .Set ("Content-Type" , "application/json" )
980980 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
981981 req .Header .Set ("X-Event-Key" , "issue:comment_created" )
@@ -1172,7 +1172,7 @@ func TestPullRequestCreated(t *testing.T) {
11721172}
11731173`
11741174
1175- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
1175+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
11761176 req .Header .Set ("Content-Type" , "application/json" )
11771177 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
11781178 req .Header .Set ("X-Event-Key" , "pullrequest:created" )
@@ -1369,7 +1369,7 @@ func TestPullRequestUpdated(t *testing.T) {
13691369}
13701370`
13711371
1372- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
1372+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
13731373 req .Header .Set ("Content-Type" , "application/json" )
13741374 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
13751375 req .Header .Set ("X-Event-Key" , "pullrequest:updated" )
@@ -1585,7 +1585,7 @@ func TestPullRequestApproved(t *testing.T) {
15851585}
15861586`
15871587
1588- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
1588+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
15891589 req .Header .Set ("Content-Type" , "application/json" )
15901590 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
15911591 req .Header .Set ("X-Event-Key" , "pullrequest:approved" )
@@ -1801,7 +1801,7 @@ func TestPullRequestApprovalRemoved(t *testing.T) {
18011801}
18021802`
18031803
1804- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
1804+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
18051805 req .Header .Set ("Content-Type" , "application/json" )
18061806 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
18071807 req .Header .Set ("X-Event-Key" , "pullrequest:unapproved" )
@@ -1998,7 +1998,7 @@ func TestPullRequestMerged(t *testing.T) {
19981998}
19991999`
20002000
2001- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
2001+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
20022002 req .Header .Set ("Content-Type" , "application/json" )
20032003 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
20042004 req .Header .Set ("X-Event-Key" , "pullrequest:fulfilled" )
@@ -2195,7 +2195,7 @@ func TestPullRequestDeclined(t *testing.T) {
21952195}
21962196`
21972197
2198- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
2198+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
21992199 req .Header .Set ("Content-Type" , "application/json" )
22002200 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
22012201 req .Header .Set ("X-Event-Key" , "pullrequest:rejected" )
@@ -2418,7 +2418,7 @@ func TestPullRequestCommentCreated(t *testing.T) {
24182418}
24192419`
24202420
2421- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
2421+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
24222422 req .Header .Set ("Content-Type" , "application/json" )
24232423 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
24242424 req .Header .Set ("X-Event-Key" , "pullrequest:comment_created" )
@@ -2641,7 +2641,7 @@ func TestPullRequestCommentUpdated(t *testing.T) {
26412641}
26422642`
26432643
2644- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
2644+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
26452645 req .Header .Set ("Content-Type" , "application/json" )
26462646 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
26472647 req .Header .Set ("X-Event-Key" , "pullrequest:comment_updated" )
@@ -2864,7 +2864,7 @@ func TestPullRequestCommentDeleted(t *testing.T) {
28642864}
28652865`
28662866
2867- req , err := http .NewRequest ("POST" , "http://127.0.0.1:3010 /webhooks" , bytes .NewBuffer ([]byte (payload )))
2867+ req , err := http .NewRequest ("POST" , "http://127.0.0.1:3009 /webhooks" , bytes .NewBuffer ([]byte (payload )))
28682868 req .Header .Set ("Content-Type" , "application/json" )
28692869 req .Header .Set ("X-Hook-UUID" , "MY_UUID" )
28702870 req .Header .Set ("X-Event-Key" , "pull_request:comment_deleted" )
0 commit comments