Skip to content

Commit

Permalink
Modify the message length limitation in ANP Condition (#4574)
Browse files Browse the repository at this point in the history
Modify the max length of Message field in ANP Condtion to 256

Signed-off-by: wenyingd <wenyingd@vmware.com>
  • Loading branch information
wenyingd authored Jan 20, 2023
1 parent da6ca96 commit ca4a70b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/networkpolicy/status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var (
// maxConditionMessageLength defines the max length of the message field in one Condition. If the actual message
// length is over size, truncate the string and use "..." in the end.
// Use a variable for test.
maxConditionMessageLength = 100
maxConditionMessageLength = 256
)

// StatusController is responsible for synchronizing the status of Antrea ClusterNetworkPolicy and Antrea NetworkPolicy.
Expand Down
12 changes: 8 additions & 4 deletions pkg/controller/networkpolicy/status_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,14 @@ func TestCreateAntreaNetworkPolicy(t *testing.T) {
},
},
}
maxConditionMessageLength = 45
defer func() {
maxConditionMessageLength = 100
}()
updateMaxConditionMessageLength := func() func() {
originalMaxConditionMessageLength := maxConditionMessageLength
maxConditionMessageLength = 45
return func() {
maxConditionMessageLength = originalMaxConditionMessageLength
}
}
defer updateMaxConditionMessageLength()()
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var initObjects []runtime.Object
Expand Down

0 comments on commit ca4a70b

Please sign in to comment.