Move execution request map to runners
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.hpi.de/codeocean/codemoon/poseidon/api/dto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -32,6 +33,21 @@ func TestMarshalRunner(t *testing.T) {
|
||||
assert.Equal(t, "{\"runnerId\":\"42\",\"status\":\"ready\"}", string(marshal))
|
||||
}
|
||||
|
||||
func TestExecutionRequestIsStored(t *testing.T) {
|
||||
runner := NewExerciseRunner("42")
|
||||
executionRequest := dto.ExecutionRequest{
|
||||
Command: "command",
|
||||
TimeLimit: 10,
|
||||
Environment: nil,
|
||||
}
|
||||
id, err := runner.AddExecution(executionRequest)
|
||||
storedExecutionRunner, ok := runner.Execution(id)
|
||||
|
||||
assert.NoError(t, err, "AddExecution should not produce an error")
|
||||
assert.True(t, ok, "Getting an execution should not return ok false")
|
||||
assert.Equal(t, executionRequest, storedExecutionRunner)
|
||||
}
|
||||
|
||||
func TestNewContextReturnsNewContextWithRunner(t *testing.T) {
|
||||
runner := NewExerciseRunner("testRunner")
|
||||
ctx := context.Background()
|
||||
|
Reference in New Issue
Block a user