Skip to content

Commit

Permalink
Use unique socket name per cm test
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt committed Sep 4, 2020
1 parent a23cf70 commit 803da10
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/kubelet/cm/devicemanager/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package devicemanager

import (
"fmt"
"path"
"testing"
"time"
Expand All @@ -26,12 +27,12 @@ import (
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
)

var (
esocketName = "mock.sock"
)
func esocketName() string {
return fmt.Sprintf("mock%d.sock", time.Now().UnixNano())
}

func TestNewEndpoint(t *testing.T) {
socket := path.Join("/tmp", esocketName)
socket := path.Join("/tmp", esocketName())

devs := []*pluginapi.Device{
{ID: "ADeviceId", Health: pluginapi.Healthy},
Expand All @@ -42,7 +43,7 @@ func TestNewEndpoint(t *testing.T) {
}

func TestRun(t *testing.T) {
socket := path.Join("/tmp", esocketName)
socket := path.Join("/tmp", esocketName())

devs := []*pluginapi.Device{
{ID: "ADeviceId", Health: pluginapi.Healthy},
Expand Down Expand Up @@ -107,7 +108,7 @@ func TestRun(t *testing.T) {
}

func TestAllocate(t *testing.T) {
socket := path.Join("/tmp", esocketName)
socket := path.Join("/tmp", esocketName())
devs := []*pluginapi.Device{
{ID: "ADeviceId", Health: pluginapi.Healthy},
}
Expand Down Expand Up @@ -160,7 +161,7 @@ func TestAllocate(t *testing.T) {
}

func TestGetPreferredAllocation(t *testing.T) {
socket := path.Join("/tmp", esocketName)
socket := path.Join("/tmp", esocketName())
callbackCount := 0
callbackChan := make(chan int)
p, e := esetup(t, []*pluginapi.Device{}, socket, "mock", func(n string, d []pluginapi.Device) {
Expand Down

0 comments on commit 803da10

Please sign in to comment.