Make api test pass and cleanup

This commit is contained in:
Jan Eitzinger
2022-09-06 14:40:14 +02:00
parent 8fbd1b2cb8
commit 937e72954d
5 changed files with 38 additions and 29 deletions

View File

@@ -28,11 +28,17 @@ import (
func setup(t *testing.T) *api.RestApi {
const testconfig = `{
"addr": "0.0.0.0:80",
"addr": "0.0.0.0:8080",
"archive": {
"kind": "file",
"path": "./var/job-archive"
},
"clusters": [
{
"name": "testcluster",
"metricDataRepository": {"kind": "test"}
}
]
}`
const testclusterJson = `{
"name": "testcluster",
@@ -109,12 +115,11 @@ func setup(t *testing.T) *api.RestApi {
config.Init(cfgFilePath)
archiveCfg := fmt.Sprintf("{\"kind\":\"file\",\"path\":\"%s\"}", jobarchive)
config.Keys.Archive = []byte(archiveCfg)
repository.Connect("sqlite3", dbfilepath)
db := repository.GetConnection()
if err := archive.Init(config.Keys.Archive); err != nil {
if err := archive.Init(json.RawMessage(archiveCfg)); err != nil {
t.Fatal(err)
}