Skip to content

Commit

Permalink
Fix tests trying to access localhost:80
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 11, 2023
1 parent faa31ec commit 7cd8677
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,13 @@ func CreateTestVoiceSession(testServerURL string) (flows.Session, []flows.Event,
func CreateSessionAssets(assetsJSON json.RawMessage, testServerURL string) (flows.SessionAssets, error) {
env := envs.NewBuilder().Build()

// different tests different ports for the test HTTP server
if testServerURL != "" {
assetsJSON = json.RawMessage(strings.Replace(string(assetsJSON), "http://localhost", testServerURL, -1))
// different tests different ports for the test HTTP server, or just let them fail to connect to port 65535
if testServerURL == "" {
testServerURL = "http://localhost:65535"
}

assetsJSON = json.RawMessage(strings.Replace(string(assetsJSON), "http://localhost", testServerURL, -1))

// read our assets into a source
source, err := static.NewSource(assetsJSON)
if err != nil {
Expand Down

0 comments on commit 7cd8677

Please sign in to comment.