Skip to content

Commit

Permalink
Update command_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-hashicorp committed Dec 10, 2024
1 parent edd914b commit ca66c5a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions subcommand/health-sync/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ func TestRun(t *testing.T) {
for _, check := range expectedSvcChecks {
log.Printf("Check Name: %s, Status: %s, ServiceName: %s, CheckId: %s\n", check.Name, check.Status, check.ServiceName, check.CheckID)
}
markDataplaneContainerUnhealthy := false
for _, expCheck := range expectedSvcChecks {
found := false
for name, hsc := range c.healthSyncContainers {

checkID := constructCheckID(makeServiceID(serviceName, taskID), name)
log.Printf("Checking for container: %s, hsc %s, CheckId: %s\n", name, hsc.status, checkID)
if expCheck.CheckID == checkID {
Expand All @@ -395,6 +395,7 @@ func TestRun(t *testing.T) {
log.Printf("Container Name: %s, ActualStatus:%s \n", containerName, c.healthSyncContainers[containerName].status)
if c.healthSyncContainers[containerName].status == ecs.HealthStatusUnhealthy {
expCheck.Status = api.HealthCritical
markDataplaneContainerUnhealthy = true
break
}
}
Expand All @@ -406,7 +407,7 @@ func TestRun(t *testing.T) {
}

if !found {
if c.missingDataplaneContainer {
if c.missingDataplaneContainer || markDataplaneContainerUnhealthy {
expCheck.Status = api.HealthCritical
} else {
expCheck.Status = api.HealthPassing
Expand Down

0 comments on commit ca66c5a

Please sign in to comment.