aboutsummaryrefslogtreecommitdiffstats
path: root/tests (unfollow)
Commit message (Collapse)AuthorLines
2019-08-04Add Pipfile script and docs for building dev venv imageGravatar MarkKoz-1/+28
The builddev script will build just the dev venv image. The testb script will build the dev venv image, clean up dangling images, and then run tests. * Give the coverage commands their own header in the README
2019-08-04Use IDs for user and group in nsjpy aliasGravatar MarkKoz-2/+2
Reflects the changes in 7a7eca52019bf21d21cdffcf03cd9c5eacd8363b
2019-08-04Rewrite README and clean up Pipfile scriptsGravatar MarkKoz-68/+98
* Make the report script do the normal coverage report instead of HTML * Remove Docker image push scripts * Add image build script for the venv image
2019-07-10Pin pydocstyle to unbreak flake8-docstringsGravatar sco1-12/+14
Relock
2019-06-29Use write_text() and fix codec namesGravatar MarkKoz-5/+3
2019-06-27Test that the file system is mounted as read onlyGravatar MarkKoz-0/+10
2019-06-27Disable swap memoryGravatar MarkKoz-3/+7
2019-06-27Fix error when setting swap limit on a system that has it disabledGravatar MarkKoz-3/+9
The error happens when either CONFIG_MEMCG_SWAP or CONFIG_MEMCG_SWAP_ENABLED is disabled in the kernel.
2019-06-26Disable memory swapping and add a memory limit testGravatar MarkKoz-8/+34
If memory swapping was enabled locally, the memory test would fail. Explicitly disabling swapping also removes reliance on the assumption that it'll be disabled in production. * Add a constant for the maximum memory * Simplify the timeout test; it'd otherwise first run out of memory now
2019-06-22Don't generate an HTML report because Azure already does itGravatar MarkKoz-2/+1
See microsoft/azure-pipelines-tasks#9704
2019-06-22Remove -it options from docker execGravatar MarkKoz-3/+3
2019-06-22Add missing steps keyGravatar MarkKoz-0/+1
2019-06-22Run linting & tests in a containerGravatar MarkKoz-14/+28
2019-06-22Fix syntax errors in azure-pipelines.ymlGravatar MarkKoz-6/+7
* Add succeededOrFailed condition to code coverage publish task * Rename test publish task for unit tests
2019-06-22Add CI steps for running & publishing testsGravatar MarkKoz-17/+49
2019-06-22Fix venv being included in coverage when testing in a containerGravatar MarkKoz-4/+7
* Exclude DEBUG checks from coverage reports
2019-06-22Add a NsJail log parser testGravatar MarkKoz-3/+33
* Add support for debug level to log regex * Change type annotation of log_parse to Iterable
2019-06-22Rewrite NsJail testsGravatar MarkKoz-58/+80
* Fix SIGSEGV test * Add embedded null byte test * Return None for stderr when there's a ValueError
2019-06-22Capture NsJail logs from stdout if NsJail fails to parse cmd argsGravatar MarkKoz-3/+9
Fixes #30
2019-06-22Use IDs for user and group for consistency across distrosGravatar MarkKoz-2/+2
2019-06-22Fix coverage not finding sourcesGravatar MarkKoz-8/+17
* Mount volume to the same path as the source directory on the host * Keep the container up in the background so it doesn't have to be restarted or the ownership fix
2019-06-22Fix ownership of coverage fileGravatar MarkKoz-1/+10
When coverage runs in a container, it is ran under root so the resulting coverage file is owned by root. chown is used to change ownership to be the same as the folder it is in.
2019-06-22Use dev.sh script for running tests and coverageGravatar MarkKoz-94/+20
* Use unittest and directly use coverage.py instead of pytest
2019-06-22Create shell script for building a dev image and running a shellGravatar MarkKoz-23/+46
* Put scripts in a new scripts folder
2019-06-22Add NsJail alias and switch to ashGravatar MarkKoz-1/+28
2019-06-22Add support for development to Docker imagesGravatar MarkKoz-7/+34
* Venv image can sync dev dependencies * Copy tests to image * Add a Pipenv script for running a development shell in a container * Add Pipenv scripts for building dev images
2019-06-15Use a custom Gunicorn access log formatGravatar MarkKoz-4/+18
The handler now shares formats with the rest of the handlers. The message is formatted to show the request method, URL + query, response code, response size in bytes, and the request time in seconds. * Use the default ISO 8601 date format for all handlers
2019-06-15Use system site instead of relying on virtual environment activationGravatar MarkKoz-14/+4
* Remove -S option from Python to re-enable importing of site module * Add environment variable NSJAIL_PATH * Remove environment variables that were passed to NsJail subprocess * Add type annotations to NsJail.__init__()
2019-06-15Merge stdout and stderrGravatar MarkKoz-5/+8
Removes the need for redirecting stderr using contextlib in the input. Furthermore, it captures errors which don't directly come from the input, such as SyntaxErrors.
2019-06-05Respond to eval with stdout, stderr, and the return codeGravatar MarkKoz-32/+37
The previous implementation limited the client's flexibility in presenting the results of the process. A process can write to both stdout and stderr and do so even when the return code is not 0 or 1. * Return a CompletedProcess from NsJail * Don't check the return code; this should be done client-side now
2019-06-05Revert "Add basic logger for responses"Gravatar MarkKoz-16/+1
Gunicorn's access logger makes the middleware redundant. This reverts commit c1c854e0ad4deb5c4fa8eb2a35b43a042f15255c.
2019-06-05Add logging for NsJailGravatar MarkKoz-28/+90
NsJail's is configured to log to a temporary file rather than stderr. The contents of the file are parsed using regex after the process exits. When not debugging, some blacklisted messages and most info-level messages are skipped. * Add a snekbox logger * Log the Python code being executed if debugging * Use nested single quotes in a test to fix a linter error
2019-06-04Configure gunicorn loggingGravatar MarkKoz-10/+24
2019-05-30Lint testsGravatar MarkKoz-6/+4
* Ignore D1xx for tests because they shouldn't require docstrings * Update pre-commit-hooks repo to v2.2.3
2019-05-30Revert "Run flake8 via pre-commit for the pipenv lint script"Gravatar MarkKoz-7/+1
This reverts commit c2416eb672afc80476fe2da1b364af5d018a16b0.
2019-05-30Revert "Lint tests"Gravatar MarkKoz-30/+1
This reverts commit e75c764f693c3688a59af0d679e0d3e94f003503.
2019-05-30Refactor NsJailGravatar MarkKoz-67/+74
2019-05-30Run flake8 via pre-commit for the pipenv lint scriptGravatar MarkKoz-1/+7
Pre-commit is a nice wrapper for this particularily because it allows both the snekbox and tests to be linted with a single command while clearly distinguishing their results. The Python script is a cross-platform implementation of the following: git ls-files -- '*.py' | xargs pre-commit run flake8 --files
2019-05-30Lint testsGravatar MarkKoz-1/+30
Tests ignore all D1xx warnings because tests shouldn't require docstrings.
2019-05-30Fix pre-commit configurationGravatar MarkKoz-1/+14
Excluded files and directories in the flake8 config file are overwritten by the --files argument, which is considered intended behaviour. However, this is problematic due to pre-commit's reliance on the --files argument. Therefore, pre-commit's own exclude config option must be leveraged. * Properly exclude tests directory * Add flake8 plugins as dependencies so that they are actually used
2019-05-29Add flake8 plugin to only allow double quotesGravatar MarkKoz-103/+119
2019-05-29Revise docstrings for SnekAPI & EvalResourceGravatar MarkKoz-9/+9
2019-05-29Add basic logger for responsesGravatar MarkKoz-1/+16
2019-05-29Document the APIGravatar MarkKoz-0/+50
2019-05-29Move SnekAPI import back to top of moduleGravatar MarkKoz-1/+2
2019-05-29Enable branch coverage & disable app.py coverageGravatar MarkKoz-9/+5
2019-05-29Add API tests for eval resourceGravatar MarkKoz-1/+65
2019-05-29Separate application instance from definitionGravatar MarkKoz-6/+16
This way, it is easier for tests to use the application because they can instead create their own instances after patching.
2019-05-28Validate request's inputGravatar MarkKoz-2/+46
2019-05-28Create falcon APIGravatar MarkKoz-59/+36