Skip to content

Commit 19e1b2e

Browse files
committed
format: remove duplicate prefix on cutom message
Signed-off-by: Atif Ali <[email protected]>
1 parent 25c9abd commit 19e1b2e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pkg/sync/sync_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ func (sc *syncContext) applyObject(t *syncTask, dryRun, validate bool) (common.R
10791079
if len(changes) > 0 {
10801080
// Sort the changes to ensure consistent order
10811081
sort.Strings(changes)
1082-
return common.ResultCodeSyncFailed, fmt.Sprintf("one or more objects failed to apply, reason: attempting to change immutable fields:\n%s\n\nForbidden: updates to statefulset spec for fields other than 'replicas', 'ordinals', 'template', 'updateStrategy', 'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden",
1082+
return common.ResultCodeSyncFailed, fmt.Sprintf("attempting to change immutable fields:\n%s\n\nForbidden: updates to statefulset spec for fields other than 'replicas', 'ordinals', 'template', 'updateStrategy', 'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden",
10831083
strings.Join(changes, "\n"))
10841084
}
10851085
}

pkg/sync/sync_context_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,7 @@ func TestStatefulSetImmutableFieldErrors(t *testing.T) {
20572057
desiredSpec: map[string]interface{}{
20582058
"serviceName": "new-svc",
20592059
},
2060-
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
2060+
expectedMessage: `attempting to change immutable fields:
20612061
- serviceName:
20622062
from: "old-svc"
20632063
to: "new-svc"
@@ -2098,7 +2098,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
20982098
},
20992099
},
21002100
},
2101-
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
2101+
expectedMessage: `attempting to change immutable fields:
21022102
- volumeClaimTemplates:
21032103
from: [data(1Gi)]
21042104
to: [data(2Gi)]
@@ -2121,7 +2121,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
21212121
},
21222122
},
21232123
},
2124-
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
2124+
expectedMessage: `attempting to change immutable fields:
21252125
- selector:
21262126
from: map[matchLabels:map[app:old-app]]
21272127
to: map[matchLabels:map[app:new-app]]
@@ -2143,7 +2143,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
21432143
},
21442144
},
21452145
},
2146-
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
2146+
expectedMessage: `attempting to change immutable fields:
21472147
- volumeClaimTemplates:
21482148
from: <nil>
21492149
to: [data]
@@ -2175,7 +2175,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
21752175
},
21762176
},
21772177
},
2178-
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
2178+
expectedMessage: `attempting to change immutable fields:
21792179
- volumeClaimTemplates:
21802180
from: [data1]
21812181
to: [data1, data2]
@@ -2192,7 +2192,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
21922192
"serviceName": "new-svc",
21932193
"podManagementPolicy": "Parallel",
21942194
},
2195-
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
2195+
expectedMessage: `attempting to change immutable fields:
21962196
- podManagementPolicy:
21972197
from: "OrderedReady"
21982198
to: "Parallel"

0 commit comments

Comments
 (0)