diff --git a/cns/restserver/v2/server_test.go b/cns/restserver/v2/server_test.go index ff64539a1b5..f5c378417ee 100644 --- a/cns/restserver/v2/server_test.go +++ b/cns/restserver/v2/server_test.go @@ -68,12 +68,13 @@ func startService(cnsPort, cnsURL string) error { if err != nil { return errors.Wrap(err, "Failed to initialize service") } - service.Name = "cns-test-server" - - service.SetOption(acncommon.OptCnsPort, cnsPort) - service.SetOption(acncommon.OptCnsURL, cnsURL) if service != nil { + service.Name = "cns-test-server" + + service.SetOption(acncommon.OptCnsPort, cnsPort) + service.SetOption(acncommon.OptCnsURL, cnsURL) + config.Server.PrimaryInterfaceIP = "localhost" err = service.Init(&config)