Tests: use separate controller listening ports to prevent conflicts (#58)

This commit is contained in:
Nikolay Edigaryev
2023-03-24 17:22:58 +00:00
committed by GitHub
parent 63ba8b5532
commit 49753ebf4c
3 changed files with 8 additions and 4 deletions
+6 -3
View File
@@ -161,8 +161,11 @@ func (controller *Controller) Run(ctx context.Context) error {
}
func (controller *Controller) Address() string {
if strings.HasPrefix(controller.listenAddr, ":") {
return fmt.Sprintf("http://localhost%s", controller.listenAddr)
hostPort := strings.ReplaceAll(controller.listener.Addr().String(), "[::]", "127.0.0.1")
if controller.tlsConfig != nil {
return fmt.Sprintf("https://%s", hostPort)
}
return controller.listenAddr
return fmt.Sprintf("http://%s", hostPort)
}