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

fix: change log level when err is http.ErrServerClosed #12167

Merged
merged 10 commits into from
Mar 22, 2024
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package destination

import (
"errors"
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, for some reason this got picked up even though it's not part of this change. Do you mind pulling latest main again?

git pull <upstream> main

should do the trick. If it doesn't, you can perhaps do a soft reset and checkout the file.

"net/http"
"testing"
"time"

Expand Down Expand Up @@ -113,8 +115,9 @@ func TestEndpointProfileTranslator(t *testing.T) {
// The queue should be full and the next update should fail.
t.Logf("Queue length=%d capacity=%d", translator.queueLen(), updateQueueCapacity)
if err := translator.Update(podAddr); err == nil {
t.Fatalf("Expected update to fail; queue=%d; capacity=%d", translator.queueLen(), updateQueueCapacity)

if !errors.Is(err, http.ErrServerClosed) {
t.Fatalf("Expected update to fail; queue=%d; capacity=%d", translator.queueLen(), updateQueueCapacity)
}
}

select {
Expand Down
8 changes: 7 additions & 1 deletion controller/cmd/destination/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package destination

import (
"context"
"errors"
"flag"
"net"
"net/http"
"os"
"os/signal"
"syscall"
Expand Down Expand Up @@ -56,7 +58,11 @@ func Main(args []string) {
go func() {
log.Infof("starting admin server on %s", *metricsAddr)
if err := adminServer.ListenAndServe(); err != nil {
log.Errorf("failed to start destination admin server: %s", err)
if errors.Is(err, http.ErrServerClosed) {
log.Infof("Admin server closed (%s)", *metricsAddr)
} else {
log.Errorf("Admin server error (%s): %s", *metricsAddr, err)
}
}
}()

Expand Down
Loading