Skip to content

Commit 13de650

Browse files
committed
fix metrics test
1 parent 89f2b68 commit 13de650

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

resource3/plugins/cpumem/metrics_test.go

+3-14
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import (
44
"context"
55
"testing"
66

7-
enginetypes "github.com/projecteru2/core/engine/types"
8-
plugintypes "github.com/projecteru2/core/resource3/plugins/types"
7+
"github.com/docker/go-units"
98
"github.com/stretchr/testify/assert"
109
)
1110

@@ -24,17 +23,7 @@ func TestGetMetrics(t *testing.T) {
2423
_, err := cm.GetMetrics(ctx, "", "")
2524
assert.Error(t, err)
2625

27-
req := &plugintypes.NodeResourceRequest{
28-
"cpu": 2,
29-
"share": 0,
30-
"memory": "1gb",
31-
"numa-cpu": []string{"0", "1"},
32-
"numa-memory": []string{"512mb", "512mb"},
33-
"xxxx": "uuuu",
34-
}
35-
36-
info := &enginetypes.Info{NCPU: 8, MemTotal: 2048}
37-
r, err := cm.AddNode(ctx, "test", req, info)
26+
nodes := generateNodes(ctx, t, cm, 1, 2, units.GB, 100, -1)
27+
_, err = cm.GetMetrics(ctx, "testpod", nodes[0])
3828
assert.NoError(t, err)
39-
assert.NotNil(t, r)
4029
}

0 commit comments

Comments
 (0)