Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverLok committed May 15, 2024
2 parents fb34694 + 0630c67 commit 7e6bc13
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions cmd/backup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion common/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion scoring/course.go
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 7e6bc13

Please sign in to comment.