mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 03:30:01 +08:00
fix: use master IP if PrometheusPushgatewayURL IP is not set in worker
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -209,6 +210,18 @@ func (b *HRPBoomer) runTestCases(testCases []*TCase, profile *boomer.Profile) {
|
||||
testcases = append(testcases, tesecase)
|
||||
}
|
||||
|
||||
if profile.PrometheusPushgatewayURL != "" {
|
||||
urlSlice := strings.Split(profile.PrometheusPushgatewayURL, ":")
|
||||
if len(urlSlice) != 2 {
|
||||
profile.PrometheusPushgatewayURL = ""
|
||||
} else {
|
||||
if urlSlice[0] == "" {
|
||||
urlSlice[0] = b.Boomer.GetMasterHost()
|
||||
}
|
||||
}
|
||||
profile.PrometheusPushgatewayURL = strings.Join(urlSlice, ":")
|
||||
}
|
||||
|
||||
b.SetProfile(profile)
|
||||
b.InitBoomer()
|
||||
log.Info().Interface("testcases", testcases).Interface("profile", profile).Msg("run tasks successful")
|
||||
|
||||
Reference in New Issue
Block a user