github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/resource/plugins/cpumem/metrics_test.go (about) 1 package cpumem 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/docker/go-units" 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func TestGetMetricsDescription(t *testing.T) { 12 ctx := context.Background() 13 cm := initCPUMEM(ctx, t) 14 md, err := cm.GetMetricsDescription(ctx) 15 assert.NoError(t, err) 16 assert.NotNil(t, md) 17 assert.Len(t, *md, 4) 18 } 19 20 func TestGetMetrics(t *testing.T) { 21 ctx := context.Background() 22 cm := initCPUMEM(ctx, t) 23 _, err := cm.GetMetrics(ctx, "", "") 24 assert.Error(t, err) 25 26 nodes := generateNodes(ctx, t, cm, 1, 2, units.GB, 100, -1) 27 _, err = cm.GetMetrics(ctx, "testpod", nodes[0]) 28 assert.NoError(t, err) 29 }