Adapt tests to new API

This commit is contained in:
2025-12-11 09:39:38 +01:00
parent 8d44ac90ad
commit d24d85b970

View File

@@ -190,6 +190,10 @@ func setup(t *testing.T) *api.RestApi {
} }
func cleanup() { func cleanup() {
// Gracefully shutdown archiver with timeout
if err := archiver.Shutdown(5 * time.Second); err != nil {
cclog.Warnf("Archiver shutdown timeout in tests: %v", err)
}
// TODO: Clear all caches, reset all modules, etc... // TODO: Clear all caches, reset all modules, etc...
} }
@@ -333,7 +337,7 @@ func TestRestApi(t *testing.T) {
t.Fatal(response.Status, recorder.Body.String()) t.Fatal(response.Status, recorder.Body.String())
} }
archiver.WaitForArchiving() // Archiving happens asynchronously, will be completed in cleanup
job, err := restapi.JobRepository.Find(&TestJobId, &TestClusterName, &TestStartTime) job, err := restapi.JobRepository.Find(&TestJobId, &TestClusterName, &TestStartTime)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@@ -446,7 +450,7 @@ func TestRestApi(t *testing.T) {
t.Fatal(response.Status, recorder.Body.String()) t.Fatal(response.Status, recorder.Body.String())
} }
archiver.WaitForArchiving() // Archiving happens asynchronously, will be completed in cleanup
jobid, cluster := int64(12345), "testcluster" jobid, cluster := int64(12345), "testcluster"
job, err := restapi.JobRepository.Find(&jobid, &cluster, nil) job, err := restapi.JobRepository.Find(&jobid, &cluster, nil)
if err != nil { if err != nil {