Add unit tests for provide runner route

This commit is contained in:
Jan-Eric Hellenberg
2021-06-08 15:50:48 +02:00
committed by Jan-Eric Hellenberg
parent 7bbd7b7bae
commit 61bc7d0143
7 changed files with 206 additions and 129 deletions

View File

@@ -18,6 +18,7 @@ const (
DeleteRoute = "deleteRunner"
RunnerIdKey = "runnerId"
ExecutionIdKey = "executionId"
ProvideRoute = "provideRunner"
)
type RunnerController struct {
@@ -28,7 +29,7 @@ type RunnerController struct {
// ConfigureRoutes configures a given router with the runner routes of our API.
func (r *RunnerController) ConfigureRoutes(router *mux.Router) {
runnersRouter := router.PathPrefix(RunnersPath).Subrouter()
runnersRouter.HandleFunc("", r.provide).Methods(http.MethodPost)
runnersRouter.HandleFunc("", r.provide).Methods(http.MethodPost).Name(ProvideRoute)
r.runnerRouter = runnersRouter.PathPrefix(fmt.Sprintf("/{%s}", RunnerIdKey)).Subrouter()
r.runnerRouter.Use(r.findRunnerMiddleware)
r.runnerRouter.HandleFunc(UpdateFileSystemPath, r.updateFileSystem).Methods(http.MethodPatch).Name(UpdateFileSystemPath)