mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-27 21:59:05 +01:00
36 lines
721 B
Go
36 lines
721 B
Go
// 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.
|
|
package repository
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/ClusterCockpit/cc-backend/internal/graph/model"
|
|
)
|
|
|
|
func TestBuildJobStatsQuery(t *testing.T) {
|
|
r := setup(t)
|
|
q := r.buildStatsQuery(nil, "USER")
|
|
|
|
sql, _, err := q.ToSql()
|
|
noErr(t, err)
|
|
|
|
fmt.Printf("SQL: %s\n", sql)
|
|
|
|
}
|
|
|
|
func TestJobStats(t *testing.T) {
|
|
r := setup(t)
|
|
|
|
filter := &model.JobFilter{}
|
|
stats, err := r.JobsStats(getContext(t), []*model.JobFilter{filter})
|
|
noErr(t, err)
|
|
|
|
if stats[0].TotalJobs != 6 {
|
|
t.Fatalf("Want 98, Got %d", stats[0].TotalJobs)
|
|
}
|
|
}
|