Skip to content

Commit 6d39383

Browse files
fix: make linter happy, cleanup
1 parent 6dd09d4 commit 6d39383

File tree

4 files changed

+5
-21
lines changed

4 files changed

+5
-21
lines changed

cns/ipam/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ import (
66
"github.com/Azure/azure-container-networking/crd/nodenetworkconfig/api/v1alpha"
77
)
88

9-
type IpamStateReconciler interface {
9+
type StateReconciler interface {
1010
ReconcileIPAMState(ncRequests []*cns.CreateNetworkContainerRequest, podInfoByIP map[string]cns.PodInfo, nnc *v1alpha.NodeNetworkConfig) cnstypes.ResponseCode
1111
}

cns/nodesubnet/initialization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"golang.org/x/exp/maps"
1212
)
1313

14-
func ReconcileInitialCNSState(ctx context.Context, ipamReconciler ipam.IpamStateReconciler, podInfoByIPProvider cns.PodInfoByIPProvider) (int, error) {
14+
func ReconcileInitialCNSState(_ context.Context, ipamReconciler ipam.StateReconciler, podInfoByIPProvider cns.PodInfoByIPProvider) (int, error) {
1515
// Get previous PodInfo state from podInfoByIPProvider
1616
podInfoByIP, err := podInfoByIPProvider.PodInfoByIP()
1717
if err != nil {

cns/nodesubnet/initialization_test.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package nodesubnet_test
22

33
import (
4-
"context"
54
"net"
65
"testing"
76

@@ -70,7 +69,7 @@ func TestNewCNSPodInfoProvider(t *testing.T) {
7069
name string
7170
store store.KeyValueStore
7271
wantErr bool
73-
reconciler ipam.IpamStateReconciler
72+
reconciler ipam.StateReconciler
7473
exp int
7574
}{
7675
{
@@ -99,12 +98,3 @@ func TestNewCNSPodInfoProvider(t *testing.T) {
9998
})
10099
}
101100
}
102-
103-
// testContext creates a context from the provided testing.T that will be
104-
// canceled if the test suite is terminated.
105-
func testContext(t *testing.T) (context.Context, context.CancelFunc) {
106-
if deadline, ok := t.Deadline(); ok {
107-
return context.WithDeadline(context.Background(), deadline)
108-
}
109-
return context.WithCancel(context.Background())
110-
}

cns/restserver/util.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState(req cns.CreateNetw
194194
fallthrough
195195
case cns.JobObject:
196196
fallthrough
197-
case cns.COW, cns.BackendNICNC:
198-
fallthrough
199-
case cns.NodeSubnet:
200-
fallthrough
201-
case cns.WebApps:
197+
case cns.COW, cns.BackendNICNC, cns.NodeSubnet, cns.WebApps:
202198
switch service.state.OrchestratorType {
203199
case cns.Kubernetes:
204200
fallthrough
@@ -232,9 +228,7 @@ func (service *HTTPRestService) saveNetworkContainerGoalState(req cns.CreateNetw
232228

233229
logger.Printf("service.state.ContainerIDByOrchestratorContext[%s] is %+v", orchestratorContext, *service.state.ContainerIDByOrchestratorContext[orchestratorContext])
234230

235-
case cns.KubernetesCRD:
236-
fallthrough
237-
case cns.KubernetesNodeSubnet:
231+
case cns.KubernetesCRD, cns.KubernetesNodeSubnet:
238232
// Validate and Update the SecondaryIpConfig state
239233
returnCode, returnMesage := service.updateIPConfigsStateUntransacted(req, existingSecondaryIPConfigs, hostVersion)
240234
if returnCode != 0 {

0 commit comments

Comments
 (0)