github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/drivers/docker/reconcile_cpuset_test.go (about)

     1  //go:build linux
     2  
     3  package docker
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/hashicorp/nomad/ci"
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func TestCoordinate_NomadCgroup(t *testing.T) {
    13  	ci.Parallel(t)
    14  
    15  	result := (coordinate{
    16  		containerID: "c6d05b36f4f56619ca59fbce921115e87dda1661860a4670e3e35ecfa3571ba1",
    17  		allocID:     "27ee5321-28d6-22d7-9426-4e1888da8e7d",
    18  		task:        "redis",
    19  		path:        "/nomad.scope/27ee5321-28d6-22d7-9426-4e1888da8e7d.redis.scope",
    20  	}).NomadCgroup()
    21  	exp := "/sys/fs/cgroup/nomad.scope/27ee5321-28d6-22d7-9426-4e1888da8e7d.redis.scope"
    22  	require.Equal(t, exp, result)
    23  }
    24  
    25  func TestCoordinate_DockerCgroup(t *testing.T) {
    26  	ci.Parallel(t)
    27  
    28  	result := (coordinate{
    29  		containerID: "c6d05b36f4f56619ca59fbce921115e87dda1661860a4670e3e35ecfa3571ba1",
    30  		allocID:     "27ee5321-28d6-22d7-9426-4e1888da8e7d",
    31  		task:        "redis",
    32  		path:        "/nomad.scope/27ee5321-28d6-22d7-9426-4e1888da8e7d.redis.scope",
    33  	}).DockerCgroup()
    34  	exp := "/sys/fs/cgroup/nomad.scope/docker-c6d05b36f4f56619ca59fbce921115e87dda1661860a4670e3e35ecfa3571ba1.scope"
    35  	require.Equal(t, exp, result)
    36  }