2024-07-02 10:13:11 +02:00
|
|
|
// 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
|
2024-07-02 10:13:11 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"testing"
|
2024-07-03 12:11:43 +02:00
|
|
|
|
|
|
|
"github.com/ClusterCockpit/cc-backend/pkg/archive"
|
2024-07-02 10:13:11 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
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()
|
|
|
|
}
|
2024-07-11 11:09:14 +02:00
|
|
|
|
2024-07-11 16:58:12 +02:00
|
|
|
for _, metric := range sc.MetricConfig {
|
|
|
|
if metric.LowerIsBetter && metric.Name != "mem_used" {
|
|
|
|
t.Fail()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-11 11:09:14 +02:00
|
|
|
// spew.Dump(archive.GlobalMetricList)
|
2024-07-11 16:12:20 +02:00
|
|
|
// t.Fail()
|
2024-07-02 10:13:11 +02:00
|
|
|
}
|