libct/int: better test container names

1. Do not create the same container named "test" over and over.

2. Fix randomization issues when generating container and cgroup names.
   The issues were:

    * math/rand used without seeding
    * complex rand/md5/hexencode sequence

   In both cases, replace with nanosecond time encoded with digits and
   lowercase letters.

3. Add test name to container and cgroup names. For example, this is
   how systemd log has changed:

   Before: Started libcontainer container test16ddfwutxgjte.
   After: Started libcontainer container TestPidsSystemd-4oaqvr.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-04-14 16:05:10 -07:00
parent fce58ab2d5
commit 7b802a7da4
6 changed files with 121 additions and 126 deletions

View File

@@ -73,7 +73,7 @@ func testCheckpoint(t *testing.T, userns bool) {
}
defer remove(rootfs)
config := newTemplateConfig(&tParam{
config := newTemplateConfig(t, &tParam{
rootfs: rootfs,
userns: userns,
})