fix: unittest

This commit is contained in:
徐聪
2022-07-11 12:31:52 +08:00
parent 1c5039697a
commit 41f7fa2d58
7 changed files with 15 additions and 10 deletions

View File

@@ -392,7 +392,7 @@ var (
gaugeState = prometheus.NewGauge(
prometheus.GaugeOpts{
Name: "state",
Help: "The current runner state, 1=initializing, 2=spawning, 3=running, 4=quitting, 5=stopped",
Help: "The current runner state, 1=initializing, 2=spawning, 3=running, 4=stopping, 5=stopped, 6=quitting, 7=missing",
},
)
gaugeDuration = prometheus.NewGauge(

View File

@@ -43,7 +43,7 @@ func getStateName(state int32) (stateName string) {
case StateQuitting:
stateName = "quitting"
case StateMissing:
stateName = "stopped"
stateName = "missing"
}
return
}
@@ -840,9 +840,12 @@ func (r *workerRunner) run() {
log.Warn().Msg("Timeout waiting for sending quit message to master, boomer will quit any way.")
}
if err = r.client.signOut(r.client.config.ctx); err != nil {
log.Error().Err(err).Msg("failed to sign out")
if r.getState() != StateMissing {
if err = r.client.signOut(r.client.config.ctx); err != nil {
log.Error().Err(err).Msg("failed to sign out")
}
}
r.client.close()
}
}()

View File

@@ -196,7 +196,7 @@ func TestSpawnWorkersWithManyTasks(t *testing.T) {
const numToSpawn int64 = 30
go runner.spawnWorkers(numToSpawn, float64(numToSpawn), runner.stopChan, runner.spawnComplete)
time.Sleep(2 * time.Second)
time.Sleep(3 * time.Second)
currentClients := runner.controller.getCurrentClientsNum()

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package boomer

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package boomer