@@ -19,6 +19,7 @@ package internal
19
19
import (
20
20
"fmt"
21
21
"os"
22
+ "strings"
22
23
"testing"
23
24
"time"
24
25
@@ -71,18 +72,27 @@ func TestPlayground(t *testing.T) {
71
72
testutil .Ok (t , prom .SetConfig (prometheusConfig (map [string ]string {
72
73
"prometheus" : prom .InternalEndpoint ("http" ),
73
74
"jaeger" : jaeger .InternalEndpoint ("http.metrics" ),
74
- "whatsup" : fmt .Sprintf ("host.docker.internal:%v" , WhatsupPort ),
75
+ "whatsup" : whatsupAddr ( fmt .Sprintf ("host.docker.internal:%v" , WhatsupPort ) ),
75
76
})))
76
77
// Due to VM based docker setups (e.g. MacOS), file sharing can be slower - do more sighups just in case (noops if all good)
77
78
prom .Exec (e2e .NewCommand ("kill" , "-SIGHUP" , "1" ))
78
79
prom .Exec (e2e .NewCommand ("kill" , "-SIGHUP" , "1" ))
79
80
80
81
// Best effort.
81
- fmt .Println (e2einteractive .OpenInBrowser ("http://" + jaeger .Endpoint ("http.front" )))
82
- fmt .Println (e2einteractive .OpenInBrowser ("http://" + prom .Endpoint ("http" )))
82
+ fmt .Println (e2einteractive .OpenInBrowser (convertToExternal ( "http://" + jaeger .Endpoint ("http.front" ) )))
83
+ fmt .Println (e2einteractive .OpenInBrowser (convertToExternal ( "http://" + prom .Endpoint ("http" ) )))
83
84
testutil .Ok (t , e2einteractive .RunUntilEndpointHitWithPort (19920 ))
84
85
}
85
86
87
+ func convertToExternal (endpoint string ) string {
88
+ a := os .Getenv ("HOSTADDR" )
89
+ if a == "" {
90
+ return endpoint
91
+ }
92
+ // YOLO, fix and test.
93
+ return fmt .Sprintf ("%v:%v" , a , strings .Split (endpoint , ":" )[2 ])
94
+ }
95
+
86
96
func prometheusConfig (jobToScrapeTargetAddress map [string ]string ) promconfig.Config {
87
97
h , _ := os .Hostname ()
88
98
cfg := promconfig.Config {
0 commit comments