mirror of https://github.com/minio/minio.git
tests: Fix failed notify webhook test (#5528)
TestNewWebHookNotify wasn't passing in my local machine. The reason is that the test expects the POST handler (as a webhook endpoint) is always running on port 80, which is not always the case.
This commit is contained in:
parent
03923947c4
commit
1e7e41fada
|
@ -54,12 +54,15 @@ func TestNewWebHookNotify(t *testing.T) {
|
|||
}
|
||||
defer os.RemoveAll(root)
|
||||
|
||||
server := httptest.NewServer(postHandler{})
|
||||
defer server.Close()
|
||||
|
||||
_, err = newWebhookNotify("1")
|
||||
if err == nil {
|
||||
t.Fatal("Unexpected should fail")
|
||||
}
|
||||
|
||||
globalServerConfig.Notify.SetWebhookByID("10", webhookNotify{Enable: true, Endpoint: "http://127.0.0.1:80"})
|
||||
globalServerConfig.Notify.SetWebhookByID("10", webhookNotify{Enable: true, Endpoint: server.URL})
|
||||
_, err = newWebhookNotify("10")
|
||||
if err != nil {
|
||||
t.Fatal("Unexpected should not fail with lookupEndpoint", err)
|
||||
|
@ -71,9 +74,6 @@ func TestNewWebHookNotify(t *testing.T) {
|
|||
t.Fatal("Unexpected should fail with invalid URL escape")
|
||||
}
|
||||
|
||||
server := httptest.NewServer(postHandler{})
|
||||
defer server.Close()
|
||||
|
||||
globalServerConfig.Notify.SetWebhookByID("20", webhookNotify{Enable: true, Endpoint: server.URL})
|
||||
webhook, err := newWebhookNotify("20")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue