Skip to content

Commit

Permalink
Ignore error if the interface already exists.
Browse files Browse the repository at this point in the history
When running unit tests inside a Nitro Enclave, we try to set up the
loopback interface multiple times, which results in an error.  This
isn't really an error though, and this commit fixes that.
  • Loading branch information
NullHypothesis committed Oct 28, 2024
1 parent 6a732e4 commit cdab573
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/sha256"
"crypto/tls"
"errors"
"io/fs"
"log"
"net"
"net/http"
Expand Down Expand Up @@ -98,7 +99,12 @@ func setupSystem(config *config.Config) (err error) {
if err := system.SeedRandomness(); err != nil {
return err
}
return system.SetupLo()
// When running unit tests inside a Nitro Enclave, the loopback interface
// may already exist, in which case we ignore the error.
if err := system.SetupLo(); err != nil && !errors.Is(err, fs.ErrExist) {
return err
}
return nil
}

func startAllWebSrvs(
Expand Down

0 comments on commit cdab573

Please sign in to comment.