Skip to content

Commit c682012

Browse files
palasanuGeorge Palasanu
andauthored
Fix a bug in the slt tag change (#37)
Co-authored-by: George Palasanu <[email protected]>
1 parent 8f874b0 commit c682012

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

test/slt/slt/slt.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,20 @@ func updateCrd() (string, string, error) {
125125
if (*cluster).Spec.Tags == nil {
126126
logger.Infof("Creating '%s' tag with the 'Tick' value...", tagSLT)
127127
(*cluster).Spec.Tags = map[string]string{tagSLT: "Tick"}
128-
129-
} else if (*cluster).Spec.Tags[tagSLT] == "Tick" {
130-
logger.Infof("Changing '%s' tag value from '%s' to '%s'...",
131-
tagSLT, (*cluster).Spec.Tags[tagSLT], "Tack")
132-
(*cluster).Spec.Tags[tagSLT] = "Tack"
133-
134-
} else if (*cluster).Spec.Tags[tagSLT] == "Tack" {
135-
logger.Infof("Changing '%s' tag value from '%s' to '%s'...",
136-
tagSLT, (*cluster).Spec.Tags[tagSLT], "Tick")
128+
} else if value, ok := (*cluster).Spec.Tags[tagSLT]; ok {
129+
if value == "Tick" {
130+
logger.Infof("Changing '%s' tag value from '%s' to '%s'...",
131+
tagSLT, value, "Tack")
132+
(*cluster).Spec.Tags[tagSLT] = "Tack"
133+
} else if value == "Tack" {
134+
logger.Infof("Changing '%s' tag value from '%s' to '%s'...",
135+
tagSLT, value, "Tick")
136+
(*cluster).Spec.Tags[tagSLT] = "Tick"
137+
} else {
138+
return "", "", fmt.Errorf("found '%s' tag with wrong value '%s'", tagSLT, value)
139+
}
140+
} else {
141+
logger.Infof("Creating '%s' tag with the 'Tick' value...", tagSLT)
137142
(*cluster).Spec.Tags[tagSLT] = "Tick"
138143
}
139144

0 commit comments

Comments
 (0)