Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cns/networkcontainers/networkcontainers.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ func (cn *NetworkContainers) Create(createNetworkContainerRequest cns.CreateNetw
func (cn *NetworkContainers) Update(createNetworkContainerRequest cns.CreateNetworkContainerRequest, netpluginConfig *NetPluginConfiguration) error {
log.Printf("[Azure CNS] NetworkContainers.Update called")
err := updateInterface(createNetworkContainerRequest, netpluginConfig)
if err == nil {
err = setWeakHostOnInterface(createNetworkContainerRequest.PrimaryInterfaceIdentifier)
}
log.Printf("[Azure CNS] NetworkContainers.Update finished.")
return err
}
Expand Down
2 changes: 1 addition & 1 deletion network/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func podNameMatches(source string, actualValue string, doExactMatch bool) bool {
} else {
// If exact match flag is disabled we just check if the existing podname field for an endpoint
// starts with passed podname string.
return (source == GetPodNameWithoutSuffix(actualValue))
return (actualValue == GetPodNameWithoutSuffix(source))
}
}

Expand Down
24 changes: 24 additions & 0 deletions network/endpoint_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2019 Microsoft. All rights reserved.
// MIT License

package network

import (
"testing"
)

func TestGetPodName(t *testing.T) {
testData := map[string]string{
"nginx-deployment-5c689d88bb": "nginx",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you gofmt this? It's just spacing/formatting. Unsure if it looks like this because of GitHub

"nginx-deployment-5c689d88bb-qwq47": "nginx-deployment",
"nginx": "nginx",
}

for testValue, expectedPodName := range testData {
podName := GetPodNameWithoutSuffix(testValue)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space

if podName != expectedPodName {
t.Error("Expected:", expectedPodName, ", Got: ", podName, ", For Test Value:", testValue)
}
}
}