Skip to content

Commit

Permalink
fix TestDiagnosticState agent health check (#5333)
Browse files Browse the repository at this point in the history
(cherry picked from commit d8bdd71)
  • Loading branch information
AndersonQ authored and mergify[bot] committed Sep 3, 2024
1 parent ecab0c3 commit a7b8760
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions testing/integration/package_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,26 @@ func TestComponentBuildHashInDiagnostics(t *testing.T) {
}

for _, c := range status.Components {
bs, err := json.MarshalIndent(status, "", " ")
if err != nil {
stateBuff.WriteString(fmt.Sprintf("%s not health, could not marshal status outptu: %v",
c.Name, err))
return false
}

state := client.State(c.State)
if state != client.Healthy {
bs, err := json.MarshalIndent(status, "", " ")
if err != nil {
stateBuff.WriteString(fmt.Sprintf("%s not health, could not marshal status outptu: %v",
c.Name, err))
return false
}

stateBuff.WriteString(fmt.Sprintf("%s not health, agent status output: %s",
c.Name, bs))
return false
}

if c.VersionInfo.Meta.Commit == "" {
stateBuff.WriteString(fmt.Sprintf("%s health, but no versionInfo. agent status output: %s",
c.Name, bs))
return false
}
}

return true
Expand Down

0 comments on commit a7b8760

Please sign in to comment.