Skip to content

Commit

Permalink
refactor: use runner factory
Browse files Browse the repository at this point in the history
Signed-off-by: Ink33 <[email protected]>
  • Loading branch information
Ink-33 committed Aug 13, 2023
1 parent 73c1382 commit 491d272
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/server/remote_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,17 @@ func (s *server) Run(ctx context.Context, task *TestTask) (reply *TestResult, er
reply = &TestResult{}

for _, testCase := range suite.Items {
simpleRunner := runner.NewSimpleTestCaseRunner()
simpleRunner.WithOutputWriter(buf)
simpleRunner.WithWriteLevel(task.Level)
suiteRunner := runner.GetTestSuiteRunner(suite)
suiteRunner.WithOutputWriter(buf)
suiteRunner.WithWriteLevel(task.Level)

// reuse the API prefix
if strings.HasPrefix(testCase.Request.API, "/") {
testCase.Request.API = fmt.Sprintf("%s%s", suite.API, testCase.Request.API)
}

output, testErr := simpleRunner.RunTestCase(&testCase, dataContext, ctx)
if getter, ok := simpleRunner.(runner.HTTPResponseRecord); ok {
output, testErr := suiteRunner.RunTestCase(&testCase, dataContext, ctx)
if getter, ok := suiteRunner.(runner.HTTPResponseRecord); ok {
resp := getter.GetResponseRecord()
reply.TestCaseResult = append(reply.TestCaseResult, &TestCaseResult{
StatusCode: int32(resp.StatusCode),
Expand Down Expand Up @@ -586,7 +586,7 @@ func (s *server) FunctionsQueryStream(srv Runner_FunctionsQueryStreamServer) err
}
}
if err := srv.Send(reply); err != nil {
return nil
return err
}
}
}
Expand Down

0 comments on commit 491d272

Please sign in to comment.