Skip to content

Commit

Permalink
Added unit test
Browse files Browse the repository at this point in the history
- added unit test for covering optimize configure when multiple workloads match but some are inactive
- fixed missing log param
- fixed should be casting isActive to bool
- added test utility SetActiveConfigProfileServer which forwards all api calls to a given url until torn down with returned function
  • Loading branch information
linkous8 committed Apr 19, 2024
1 parent 3efcdf1 commit e466597
Show file tree
Hide file tree
Showing 3 changed files with 671 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/optimize/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ FROM entities(k8s:deployment)[attributes("k8s.cluster.name") = "{{.Cluster}}" &&
if workloadIdsFound < 1 {
return errors.New("unable to configure optimizer; no workload IDs matched the given criteria")
} else if workloadIdsFound > 1 {
log.Warnf("found %v workload IDs for the given criteria, pruning inactive results")
log.Warnf("found %v workload IDs for the given criteria, pruning inactive results", workloadIdsFound)

var activeIds []any
for _, workloadRow := range mainDataSet.Data {
if workloadRow[1].(string) == "true" {
if workloadRow[1].(bool) {
activeIds = append(activeIds, workloadRow[0])
}
}
Expand Down
Loading

0 comments on commit e466597

Please sign in to comment.