Skip to content

Commit

Permalink
Update controller and server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
camerondurham committed Jul 2, 2024
1 parent 1947b55 commit 000b763
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions engine/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ func TestSubmitRequest(t *testing.T) {
Stderr: "world",
}

errorCaseOutput := &runtime.RunOutput{
Stdout: "",
Stderr: "compilation error",
}

errorCaseOutputError := errors.New("Error")

preRunProps := &runtime.RunProps{
RunArgs: []string{"echo", "hello", "world"},
Timeout: 0,
Expand Down Expand Up @@ -296,7 +303,7 @@ func TestSubmitRequest(t *testing.T) {
},
},
{
name: "Last runner is ready: pre run cmd error",
name: "Last runner is ready: command error",
runProps: &Props{
PreRunProps: preRunProps,
RunProps: &runtime.RunProps{},
Expand All @@ -313,17 +320,17 @@ func TestSubmitRequest(t *testing.T) {
{
state: runtime.Ready,
shouldBePickedAsRunner: true,
returnOutput: happyCaseOutput,
returnErr: nil,
returnOutput: errorCaseOutput,
returnErr: errorCaseOutputError,
writeErr: nil,
preRunErr: errors.New("some error"),
preRunErr: nil,
preRunCmd: preRunProps,
},
},
want: CtrlRunOutput{
ControllerErr: PreRunError,
RunOutput: nil,
CommandErr: nil,
ControllerErr: nil,
RunOutput: errorCaseOutput,
CommandErr: errorCaseOutputError,
},
}}

Expand Down
2 changes: 1 addition & 1 deletion server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int main() {
args: args{
r: newRequest("POST", "url", api.RunRequest{
Source: "print(\"hello\")",
Lang: coderunner.Go.Name,
Lang: "random-lang",
}),
expectedStatusCode: 400,
},
Expand Down

0 comments on commit 000b763

Please sign in to comment.