mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
* tests: swap testify for test in plugins/csi/client_test.go * tests: swap testify for test in testutil/ * tests: swap testify for test in host_test.go * tests: swap testify for test in plugin_test.go * tests: swap testify for test in utils_test.go * tests: swap testify for test in scheduler/ * tests: swap testify for test in parse_test.go * tests: swap testify for test in attribute_test.go * tests: swap testify for test in plugins/drivers/ * tests: swap testify for test in command/ * tests: fixup some test usages * go: run go mod tidy * windows: cpuset test only on linux
45 lines
695 B
Go
45 lines
695 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
//go:build linux
|
|
|
|
package docker
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/hashicorp/nomad/ci"
|
|
"github.com/shoenig/test/must"
|
|
)
|
|
|
|
func Test_cpuset_watch(t *testing.T) {
|
|
ci.Parallel(t)
|
|
|
|
doneCh := make(chan bool)
|
|
|
|
source := "/source"
|
|
destination := "/destination"
|
|
hits := 0
|
|
|
|
callback := func(s, d string) {
|
|
must.Eq(t, source, s)
|
|
must.Eq(t, destination, d)
|
|
hits++
|
|
}
|
|
|
|
c := &cpuset{
|
|
doneCh: doneCh,
|
|
source: "/source",
|
|
destination: "/destination",
|
|
previous: "",
|
|
sync: callback,
|
|
}
|
|
go c.watch()
|
|
|
|
time.Sleep(3*time.Second + 10*time.Millisecond)
|
|
doneCh <- true
|
|
|
|
must.Eq(t, 1, hits)
|
|
}
|