add test case for available cgroups

This commit is contained in:
Chelsea Holland Komlo 2018-01-25 06:02:40 -05:00
parent 9a8344333b
commit 3d38868b88
1 changed files with 26 additions and 0 deletions

View File

@ -121,4 +121,30 @@ func TestCGroupFingerprint(t *testing.T) {
t.Fatalf("unexpected attribute found, %s", a)
}
}
{
f := &CGroupFingerprint{
logger: testLogger(),
lastState: cgroupAvailable,
mountPointDetector: &MountPointDetectorValidMountPoint{},
}
node := &structs.Node{
Attributes: make(map[string]string),
}
request := &cstructs.FingerprintRequest{Config: &config.Config{}, Node: node}
response := &cstructs.FingerprintResponse{
Attributes: make(map[string]string, 0),
Links: make(map[string]string, 0),
Resources: &structs.Resources{},
}
err := f.Fingerprint(request, response)
if err != nil {
t.Fatalf("unexpected error, %s", err)
}
if a, _ := response.Attributes["unique.cgroup.mountpoint"]; a == "" {
t.Fatalf("expected attribute to be found, %s", a)
}
}
}