Skip to content

Commit a43c16e

Browse files
committed
fixed go lint pr test err
1 parent 7cc4960 commit a43c16e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func addDefaultDenyACL(podIPInfo *cns.PodIpInfo) error {
9191
}
9292

9393
func getDefaultDenyACLPolicy(direction hcn.DirectionType) ([]byte, error) {
94+
const DefaultDenyPriority = 10000
9495
type DefaultDenyACL struct {
9596
Type string `json:"Type"`
9697
Action hcn.ActionType `json:"Action"`
@@ -101,12 +102,12 @@ func getDefaultDenyACLPolicy(direction hcn.DirectionType) ([]byte, error) {
101102
Type: "ACL",
102103
Action: hcn.ActionTypeBlock,
103104
Direction: direction,
104-
Priority: 10000,
105+
Priority: DefaultDenyPriority,
105106
}
106107
denyACLJSON, err := json.Marshal(denyACL)
107108
if err != nil {
108109
fmt.Println("Error marshaling default deny policy:", err)
109-
return nil, nil
110+
return nil, err
110111
}
111112
return denyACLJSON, nil
112113
}

cns/middlewares/k8sSwiftV2_windows_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ func TestAddDefaultDenyACL(t *testing.T) {
139139
MacAddress: "12:34:56:78:9a:bc",
140140
}
141141

142-
addDefaultDenyACL(&podIPInfo)
142+
err := addDefaultDenyACL(&podIPInfo)
143+
assert.Equal(t, err, nil)
143144

144145
// Normalize both slices so there is no extra spacing, new lines, etc
145146
normalizedExpected := normalizeKVPairs(t, expectedDefaultDenyACL)

0 commit comments

Comments
 (0)