diff --git a/README.md b/README.md index 7c86075c..ac1e7b13 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,10 @@ pip install autograder-py ## Running the Server The main server is available via the `cmd/server` executable. +``` +./bin/server +``` + The `web.port` config option can be used to set the port the server listens on: ``` ./bin/server -c web.port=80 @@ -159,6 +163,20 @@ The `setcap.sh` script will do this for you: ./setcap.sh ``` +### Running the Server for Testing + +You may want to run the server for testing/debugging, +e.g., if you are developing an interface to the server. +We recommend two additional changes to how you would normally run the server: +``` +go run cmd/server/main.go --unit-testing +``` + +First, we ran the server using `go run`, +This will ensure that the server executable is up-to-date before running it. +Second we used the `--unit-testing` flag, +which will set some testing options, create a clean new database, and load the test courses (inside the `_tests directory). + ## Running Tests This repository comes with several types of tests. diff --git a/cmd/backup/main.go b/cmd/backup/main.go index 07972a8f..c0008dc8 100644 --- a/cmd/backup/main.go +++ b/cmd/backup/main.go @@ -33,6 +33,7 @@ func main() { var courses map[string]*model.Course; if (args.Course != "") { + courses = make(map[string]*model.Course); course := db.MustGetCourse(args.Course); courses[course.GetID()] = course; } else { diff --git a/common/http.go b/common/http.go index b2a7c222..c26b92c2 100644 --- a/common/http.go +++ b/common/http.go @@ -202,7 +202,7 @@ func doRequest(uri string, request *http.Request, verb string, checkResult bool) log.Error("Got a non-OK status.", log.NewAttr("code", response.StatusCode), log.NewAttr("body", body), log.NewAttr("headers", response.Header), log.NewAttr("url", uri)); - return "", nil, fmt.Errorf("Got a non-OK status code '%d' from %s on URL '%s': '%w'.", response.StatusCode, verb, uri, err); + return "", nil, fmt.Errorf("Got a non-OK status code '%d' from %s on URL '%s'.", response.StatusCode, verb, uri); } return body, response.Header, nil; diff --git a/scoring/course.go b/scoring/course.go index 08cf8fdd..3c385c16 100644 --- a/scoring/course.go +++ b/scoring/course.go @@ -24,7 +24,7 @@ func FullCourseScoringAndUpload(course *model.Course, dryRun bool) error { err := FullAssignmentScoringAndUpload(assignment, dryRun); if (err != nil) { - return fmt.Errorf("Failed to grade assignment '%s' for course '%s': '%w'.", course.GetID(), assignment.GetID(), err); + return fmt.Errorf("Failed to grade assignment '%s' for course '%s': '%w'.", assignment.GetID(), course.GetID(), err); } }