Skip to content

Commit d8bdd71

Browse files
authored
fix TestDiagnosticState agent health check (#5333)
1 parent 1e57055 commit d8bdd71

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

testing/integration/package_version_test.go

+13-6
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,26 @@ func TestComponentBuildHashInDiagnostics(t *testing.T) {
102102
}
103103

104104
for _, c := range status.Components {
105+
bs, err := json.MarshalIndent(status, "", " ")
106+
if err != nil {
107+
stateBuff.WriteString(fmt.Sprintf("%s not health, could not marshal status outptu: %v",
108+
c.Name, err))
109+
return false
110+
}
111+
105112
state := client.State(c.State)
106113
if state != client.Healthy {
107-
bs, err := json.MarshalIndent(status, "", " ")
108-
if err != nil {
109-
stateBuff.WriteString(fmt.Sprintf("%s not health, could not marshal status outptu: %v",
110-
c.Name, err))
111-
return false
112-
}
113114

114115
stateBuff.WriteString(fmt.Sprintf("%s not health, agent status output: %s",
115116
c.Name, bs))
116117
return false
117118
}
119+
120+
if c.VersionInfo.Meta.Commit == "" {
121+
stateBuff.WriteString(fmt.Sprintf("%s health, but no versionInfo. agent status output: %s",
122+
c.Name, bs))
123+
return false
124+
}
118125
}
119126

120127
return true

0 commit comments

Comments
 (0)