Skip to content

Commit 867002b

Browse files
committed
nodes_tests: Fix tests with new test data according to new way of parsing sinfo data
Might require some more fresh data from a real server
1 parent dff6df3 commit 867002b

File tree

2 files changed

+14
-718
lines changed

2 files changed

+14
-718
lines changed

nodes_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"io/ioutil"
2020
"os"
2121
"testing"
22+
23+
"github.com/stretchr/testify/assert"
2224
)
2325

2426
func TestNodesMetrics(t *testing.T) {
@@ -28,13 +30,10 @@ func TestNodesMetrics(t *testing.T) {
2830
t.Fatalf("Can not open test data: %v", err)
2931
}
3032
data, err := ioutil.ReadAll(file)
31-
t.Logf("%+v", ParseNodesMetrics(data))
32-
}
33-
34-
func TestNodesGetPartitions(t *testing.T) {
35-
t.Logf("%+v", SlurmGetPartitions())
36-
}
37-
38-
func TestNodesGetMetrics(t *testing.T) {
39-
t.Logf("%+v", NodesGetMetrics("foo"))
33+
nm := ParseNodesMetrics(data)
34+
assert.Equal(t, 10, int(nm.idle["feature_a,feature_b"]))
35+
assert.Equal(t, 10, int(nm.down["feature_a,feature_b"]))
36+
assert.Equal(t, 40, int(nm.alloc["feature_a,feature_b"]))
37+
assert.Equal(t, 20, int(nm.alloc["feature_a"]))
38+
assert.Equal(t, 10, int(nm.down["null"]))
4039
}

0 commit comments

Comments
 (0)