Skip to content

Commit

Permalink
Rename fileLimit to outputLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
mejedi committed Dec 14, 2019
1 parent aa0183f commit 8969b82
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ JSON object with `status` key. Depending on the status aditional keys might be p
* **memoryLimit**: memory limit as set by cgroup's `memory.max` exceeded
* **pidsLimit**: pids limit as set by cgroup's `pids.max` exceeded
* **timeLimit**: run time limit exceeded, see `timeLimit` in [Request](#Request) section
* **fileLimit**: task output is written to a file; file size limit exceeded, see `pipes` in [Request](#Request) section
* **outputLimit**: task output size limit exceeded, see `pipes`, `copyFiles` and `stdStreams` in [Request](#Request) section
* **requestInvalid**: request JSON invalid
* **description**: error description
* **internalError**: internal error
Expand Down Expand Up @@ -185,7 +185,7 @@ Optional keys:
Chroot prefix (if any) is automatically prepended to the path in `src` key.

Optional `limit` numeric key caps the maximum amount of collected data (no limit by default).
If the limit is exeeded, the task terminates with `status:fileLimit`.
If the limit is exeeded, the task terminates with `status:outputLimit`.

* **copyFiles**: object []

Expand Down
2 changes: 1 addition & 1 deletion src/fail.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const char kStatusKilled[] = "killed";
const char kStatusMemoryLimit[] = "memoryLimit";
const char kStatusPidsLimit[] = "pidsLimit";
const char kStatusTimeLimit[] = "timeLimit";
const char kStatusFileLimit[] = "fileLimit";
const char kStatusOutputLimit[] = "outputLimit";
const char kStatusInternalError[] = "internalError";
const char kStatusRequestInvalid[] = "requestInvalid";
const char kStatusResponseTooBig[] = "responseTooBig";
Expand Down
2 changes: 1 addition & 1 deletion src/sandals.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern const char kStatusKilled[]; // = "killed"
extern const char kStatusMemoryLimit[]; // = "memoryLimit"
extern const char kStatusPidsLimit[]; // = "pidsLimit"
extern const char kStatusTimeLimit[]; // = "timeLimit"
extern const char kStatusFileLimit[]; // = "fileLimit"
extern const char kStatusOutputLimit[]; // = "outputLimit"
extern const char kStatusInternalError[]; // = "internalError"
extern const char kStatusRequestInvalid[]; // = "requestInvalid"
extern const char kStatusResponseTooBig[]; // = "responseTooBig"
Expand Down
2 changes: 1 addition & 1 deletion src/supervisor.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static int do_pipes(struct sandals_supervisor *s) {
if (rc) {
s->response.size = 0;
response_append_raw(&s->response, "{\"status\":\"");
response_append_esc(&s->response, kStatusFileLimit);
response_append_esc(&s->response, kStatusOutputLimit);
response_append_raw(&s->response, "\"}\n");
status = -1;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ function pidsLimit(request) {
return r;
}

function fileLimit(request) {
function outputLimit(request) {
const r = sandals(request);
if (r.status != 'fileLimit') assert.fail(r);
if (r.status != 'outputLimit') assert.fail(r);
return r;
}

Expand Down Expand Up @@ -138,7 +138,7 @@ module.exports = {
timeLimit,
memoryLimit,
pidsLimit,
fileLimit,
outputLimit,
test,
testAtExit: fn=>cleanupHandlers.push(fn),
getInfo,
Expand Down
6 changes: 3 additions & 3 deletions tests/pipes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assert = require('assert');
const {
test, requestInvalid, exited, internalError, fileLimit, TmpFile
test, requestInvalid, exited, internalError, outputLimit, TmpFile
} = require('./harness');

test('pipesInvalid', ()=>{
Expand Down Expand Up @@ -50,7 +50,7 @@ test('pipes3', ()=>{

test('pipeslimit', ()=>{
const output = new TmpFile();
fileLimit({
outputLimit({
cmd: ['yes'],
pipes: [{dest: output, stdout: true, limit: 10}]
});
Expand All @@ -66,7 +66,7 @@ test('copyFilesEarlyFailure', ()=>{

test('copyFilesLimit', ()=>{
const output = new TmpFile();
fileLimit({
outputLimit({
cmd: ['echo', '0123456789abcdef'],
mounts: [{type: 'tmpfs', dest: '/tmp'}],
copyFiles: [{src: '/tmp/output', dest: output, stdout: true, limit: 4}]
Expand Down

0 comments on commit 8969b82

Please sign in to comment.