Skip to content

Commit

Permalink
Stabilize label order so tests don't fail randomly
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin committed Nov 24, 2021
1 parent c66d35d commit 42d6557
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pkg/operator/client/deploy.go
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"os/exec"
"path/filepath"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -662,14 +663,17 @@ func getRemovedCharts(prevDir string, curDir string) ([]string, error) {
}

func getLabelSelector(appLabelSelector *metav1.LabelSelector) string {
retString := ""
allKeys := make([]string, 0)
for key := range appLabelSelector.MatchLabels {
allKeys = append(allKeys, key)
}

sort.Strings(allKeys)

allLabels := make([]string, 0)
for key, val := range appLabelSelector.MatchLabels {
if retString == "" {
retString = fmt.Sprintf("%s=%s", key, val)
} else {
retString = fmt.Sprintf("%s,%s=%s", retString, key, val)
}
allLabels = append(allLabels, fmt.Sprintf("%s=%s", key, val))
}

return retString
return strings.Join(allLabels, ",")
}

0 comments on commit 42d6557

Please sign in to comment.