add test case for available cgroups
This commit is contained in:
parent
9a8344333b
commit
3d38868b88
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue