aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/controller/processor_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-02-13 13:59:19 +0100
committerAleksandr Nogikh <nogikh@google.com>2025-02-14 13:40:12 +0000
commiteaf86f3f4dc8a7190abf09fe840e20bcf83709d8 (patch)
treec28d030a8923833ffc39005b1a57946cd48fea62 /syz-cluster/controller/processor_test.go
parent59c86b9e1c7a0f91fbb1b680676f33b4cc7bf137 (diff)
syz-cluster/controller: move the API server to pkg/controller
This will facilitate its reuse in tests.
Diffstat (limited to 'syz-cluster/controller/processor_test.go')
-rw-r--r--syz-cluster/controller/processor_test.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/syz-cluster/controller/processor_test.go b/syz-cluster/controller/processor_test.go
index f56108d3f..ff85ebec9 100644
--- a/syz-cluster/controller/processor_test.go
+++ b/syz-cluster/controller/processor_test.go
@@ -6,13 +6,13 @@ package main
import (
"context"
"fmt"
- "net/http/httptest"
"sync"
"testing"
"time"
"github.com/google/syzkaller/syz-cluster/pkg/api"
"github.com/google/syzkaller/syz-cluster/pkg/app"
+ "github.com/google/syzkaller/syz-cluster/pkg/controller"
"github.com/google/syzkaller/syz-cluster/pkg/db"
"github.com/google/syzkaller/syz-cluster/pkg/workflow"
"github.com/stretchr/testify/assert"
@@ -42,7 +42,7 @@ func TestProcessor(t *testing.T) {
})
}
for _, series := range allSeries[0:5] {
- uploadSeries(t, ctx, client, series)
+ controller.UploadTestSeries(t, ctx, client, series)
}
// Let some workflows finish.
@@ -66,7 +66,7 @@ func TestProcessor(t *testing.T) {
// Add some more series.
for _, series := range allSeries[5:10] {
- uploadSeries(t, ctx, client, series)
+ controller.UploadTestSeries(t, ctx, client, series)
}
// Finish all of them.
@@ -143,14 +143,12 @@ func newMockedWorkflows() *mockedWorkflows {
func prepareProcessorTest(t *testing.T, workflows workflow.Service) (*SeriesProcessor,
*api.Client, context.Context) {
env, ctx := app.TestEnvironment(t)
- apiServer := NewControllerAPI(env)
- server := httptest.NewServer(apiServer.Mux())
- t.Cleanup(server.Close)
+ client := controller.TestServer(t, env)
return &SeriesProcessor{
seriesRepo: db.NewSeriesRepository(env.Spanner),
sessionRepo: db.NewSessionRepository(env.Spanner),
workflows: workflows,
dbPollInterval: time.Second / 10,
parallelWorkers: 2,
- }, api.NewClient(server.URL), ctx
+ }, client, ctx
}