mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Fix and test subcluster Config
This commit is contained in:
parent
b05909969f
commit
1b70596735
@ -59,6 +59,7 @@ func initClusterConfig() error {
|
|||||||
|
|
||||||
for _, sc := range cluster.SubClusters {
|
for _, sc := range cluster.SubClusters {
|
||||||
newMetric := mc
|
newMetric := mc
|
||||||
|
newMetric.SubClusters = nil
|
||||||
|
|
||||||
if cfg, ok := scLookup[sc.Name]; ok {
|
if cfg, ok := scLookup[sc.Name]; ok {
|
||||||
if !cfg.Remove {
|
if !cfg.Remove {
|
||||||
@ -69,13 +70,20 @@ func initClusterConfig() error {
|
|||||||
newMetric.Alert = cfg.Alert
|
newMetric.Alert = cfg.Alert
|
||||||
newMetric.Footprint = cfg.Footprint
|
newMetric.Footprint = cfg.Footprint
|
||||||
sc.MetricConfig = append(sc.MetricConfig, *newMetric)
|
sc.MetricConfig = append(sc.MetricConfig, *newMetric)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if newMetric.Footprint {
|
if newMetric.Footprint {
|
||||||
sc.Footprint = append(sc.Footprint, newMetric.Name)
|
sc.Footprint = append(sc.Footprint, newMetric.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sc.MetricConfig = append(sc.MetricConfig, *newMetric)
|
||||||
|
|
||||||
|
if newMetric.Footprint {
|
||||||
|
sc.Footprint = append(sc.Footprint, newMetric.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Clusters = append(Clusters, cluster)
|
Clusters = append(Clusters, cluster)
|
||||||
|
@ -9,15 +9,22 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ClusterCockpit/cc-backend/pkg/archive"
|
"github.com/ClusterCockpit/cc-backend/pkg/archive"
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestClusterConfig(t *testing.T) {
|
func TestClusterConfig(t *testing.T) {
|
||||||
if err := archive.Init(json.RawMessage("{\"kind\":\"testdata/archive\"}"), false); err != nil {
|
if err := archive.Init(json.RawMessage("{\"kind\": \"file\",\"path\": \"testdata/archive\"}"), false); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c := archive.GetCluster("fritz")
|
sc, err := archive.GetSubCluster("fritz", "spr1tb")
|
||||||
spew.Dump(c)
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
// spew.Dump(sc.MetricConfig)
|
||||||
|
if len(sc.Footprint) != 3 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
|
if len(sc.MetricConfig) != 15 {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
2332
pkg/archive/testdata/archive/alex/cluster.json
vendored
2332
pkg/archive/testdata/archive/alex/cluster.json
vendored
File diff suppressed because it is too large
Load Diff
1519
pkg/archive/testdata/archive/fritz/cluster.json
vendored
1519
pkg/archive/testdata/archive/fritz/cluster.json
vendored
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user