Add tests for runners execute route

Co-authored-by: Tobias Kantusch <tobias.kantusch@student.hpi.uni-potsdam.de>
This commit is contained in:
Konrad Hanff
2021-04-30 16:23:00 +02:00
parent 6a00ea3165
commit 612bc55bdd
10 changed files with 300 additions and 90 deletions

View File

@ -4,6 +4,7 @@ import (
"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
"gitlab.hpi.de/codeocean/codemoon/poseidon/config"
"gitlab.hpi.de/codeocean/codemoon/poseidon/environment/pool"
"net/http"
"net/http/httptest"
"testing"
@ -16,7 +17,7 @@ func mockHTTPHandler(writer http.ResponseWriter, _ *http.Request) {
func TestNewRouterV1WithAuthenticationDisabled(t *testing.T) {
config.Config.Server.Token = ""
router := mux.NewRouter()
v1 := newRouterV1(router)
v1 := newRouterV1(router, pool.NewLocalRunnerPool())
t.Run("health route is accessible", func(t *testing.T) {
request, err := http.NewRequest(http.MethodGet, "/api/v1/health", nil)
@ -43,7 +44,7 @@ func TestNewRouterV1WithAuthenticationDisabled(t *testing.T) {
func TestNewRouterV1WithAuthenticationEnabled(t *testing.T) {
config.Config.Server.Token = "TestToken"
router := mux.NewRouter()
v1 := newRouterV1(router)
v1 := newRouterV1(router, pool.NewLocalRunnerPool())
t.Run("health route is accessible", func(t *testing.T) {
request, err := http.NewRequest(http.MethodGet, "/api/v1/health", nil)