Skip to content

Commit

Permalink
format: remove duplicate prefix on cutom message
Browse files Browse the repository at this point in the history
Signed-off-by: Atif Ali <[email protected]>
  • Loading branch information
aali309 committed Dec 13, 2024
1 parent 25c9abd commit 19e1b2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/sync/sync_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ func (sc *syncContext) applyObject(t *syncTask, dryRun, validate bool) (common.R
if len(changes) > 0 {
// Sort the changes to ensure consistent order
sort.Strings(changes)
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",
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",
strings.Join(changes, "\n"))
}
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/sync/sync_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2057,7 +2057,7 @@ func TestStatefulSetImmutableFieldErrors(t *testing.T) {
desiredSpec: map[string]interface{}{
"serviceName": "new-svc",
},
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
expectedMessage: `attempting to change immutable fields:
- serviceName:
from: "old-svc"
to: "new-svc"
Expand Down Expand Up @@ -2098,7 +2098,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
},
},
},
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
expectedMessage: `attempting to change immutable fields:
- volumeClaimTemplates:
from: [data(1Gi)]
to: [data(2Gi)]
Expand All @@ -2121,7 +2121,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
},
},
},
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
expectedMessage: `attempting to change immutable fields:
- selector:
from: map[matchLabels:map[app:old-app]]
to: map[matchLabels:map[app:new-app]]
Expand All @@ -2143,7 +2143,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
},
},
},
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
expectedMessage: `attempting to change immutable fields:
- volumeClaimTemplates:
from: <nil>
to: [data]
Expand Down Expand Up @@ -2175,7 +2175,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
},
},
},
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
expectedMessage: `attempting to change immutable fields:
- volumeClaimTemplates:
from: [data1]
to: [data1, data2]
Expand All @@ -2192,7 +2192,7 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
"serviceName": "new-svc",
"podManagementPolicy": "Parallel",
},
expectedMessage: `one or more objects failed to apply, reason: attempting to change immutable fields:
expectedMessage: `attempting to change immutable fields:
- podManagementPolicy:
from: "OrderedReady"
to: "Parallel"
Expand Down

0 comments on commit 19e1b2e

Please sign in to comment.