cc-backend/pkg/archive/clusterConfig_test.go

40 lines
859 B
Go
Raw Permalink Normal View History

// Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
// All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
2024-07-03 12:11:43 +02:00
package archive_test
import (
"encoding/json"
"testing"
2024-07-03 12:11:43 +02:00
"github.com/ClusterCockpit/cc-backend/pkg/archive"
)
func TestClusterConfig(t *testing.T) {
2024-07-04 06:49:59 +02:00
if err := archive.Init(json.RawMessage("{\"kind\": \"file\",\"path\": \"testdata/archive\"}"), false); err != nil {
2024-07-03 12:11:43 +02:00
t.Fatal(err)
}
2024-07-04 06:49:59 +02:00
sc, err := archive.GetSubCluster("fritz", "spr1tb")
if err != nil {
t.Fatal(err)
}
// spew.Dump(sc.MetricConfig)
if len(sc.Footprint) != 3 {
t.Fail()
}
if len(sc.MetricConfig) != 15 {
t.Fail()
}
for _, metric := range sc.MetricConfig {
if metric.LowerIsBetter && metric.Name != "mem_used" {
t.Fail()
}
}
// spew.Dump(archive.GlobalMetricList)
// t.Fail()
}