mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 21:50:22 +03:00
config: setter/getter for Notifier and Logger into its own struct. (#3721)
This is an attempt cleanup code and keep the top level config functions simpler and easy to understand where as move the notifier related code and logger setter/getter methods as part of their own struct. Locks are now held properly not globally by configMutex, but instead as private variables. Final fix for #3700
This commit is contained in:
@@ -51,13 +51,13 @@ func TestNewWebHookNotify(t *testing.T) {
|
||||
t.Fatal("Unexpected should fail")
|
||||
}
|
||||
|
||||
serverConfig.SetWebhookNotifyByID("10", webhookNotify{Enable: true, Endpoint: "http://www."})
|
||||
serverConfig.Notify.SetWebhookByID("10", webhookNotify{Enable: true, Endpoint: "http://www."})
|
||||
_, err = newWebhookNotify("10")
|
||||
if err == nil {
|
||||
t.Fatal("Unexpected should fail with lookupHost")
|
||||
}
|
||||
|
||||
serverConfig.SetWebhookNotifyByID("15", webhookNotify{Enable: true, Endpoint: "http://%"})
|
||||
serverConfig.Notify.SetWebhookByID("15", webhookNotify{Enable: true, Endpoint: "http://%"})
|
||||
_, err = newWebhookNotify("15")
|
||||
if err == nil {
|
||||
t.Fatal("Unexpected should fail with invalid URL escape")
|
||||
@@ -66,7 +66,7 @@ func TestNewWebHookNotify(t *testing.T) {
|
||||
server := httptest.NewServer(postHandler{})
|
||||
defer server.Close()
|
||||
|
||||
serverConfig.SetWebhookNotifyByID("20", webhookNotify{Enable: true, Endpoint: server.URL})
|
||||
serverConfig.Notify.SetWebhookByID("20", webhookNotify{Enable: true, Endpoint: server.URL})
|
||||
webhook, err := newWebhookNotify("20")
|
||||
if err != nil {
|
||||
t.Fatal("Unexpected shouldn't fail", err)
|
||||
|
||||
Reference in New Issue
Block a user