Update code for latest containerd.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-10-04 19:15:36 -07:00
parent 4e2b4aa972
commit 2ce0bb0926
2 changed files with 12 additions and 157 deletions

View File

@@ -21,30 +21,30 @@ package server
import (
"testing"
"github.com/containerd/cgroups"
v1 "github.com/containerd/cgroups/stats/v1"
"github.com/stretchr/testify/assert"
)
func TestGetWorkingSet(t *testing.T) {
for desc, test := range map[string]struct {
memory *cgroups.MemoryStat
memory *v1.MemoryStat
expected uint64
}{
"nil memory usage": {
memory: &cgroups.MemoryStat{},
memory: &v1.MemoryStat{},
expected: 0,
},
"memory usage higher than inactive_total_file": {
memory: &cgroups.MemoryStat{
memory: &v1.MemoryStat{
TotalInactiveFile: 1000,
Usage: &cgroups.MemoryEntry{Usage: 2000},
Usage: &v1.MemoryEntry{Usage: 2000},
},
expected: 1000,
},
"memory usage lower than inactive_total_file": {
memory: &cgroups.MemoryStat{
memory: &v1.MemoryStat{
TotalInactiveFile: 2000,
Usage: &cgroups.MemoryEntry{Usage: 1000},
Usage: &v1.MemoryEntry{Usage: 1000},
},
expected: 0,
},