README.md

o2r-inspecter

Build Status Microbadger

Inspection of binary files for the o2r Web API.

Implements the endpoint /api/v1/inspection using plumber.

Run

Configuration is done via environment variables. They must be set before loading the package (i.e. library("inspecter")).

From R:

Sys.setenv(DEBUGME = "inspecter")
library("inspecter")
inspecter::start()

With Docker:

docker build --tag inspecter .
docker run --rm -it -p 8091:8091 inspecter

Configuration

API docs

See http://o2r.info/o2r-web-api/compendium/files/#file-inspection-rdata

<ip>:8091/status shows the microservice status.

For security reasons, inputs (namely file and objects) are processed to contain only characters allowed for filenames or R objects respectively.

Development

Sys.setenv("DEBUGME" = "inspecter", "INSPECTER_BASEPATH" = file.path(getwd(), "tests/testthat/data"))
library("inspecter")
inspecter::start()

For developing tests, it is useful to run the service from the terminal and have the R session for writing the tests:

DEBUGME=inspecter INSPECTER_BASEPATH=$(pwd)/tests/testthat/data R -q -e 'library("inspecter"); inspecter::start()'

plumber integrates a swagger UI, you can open it at http://127.0.0.1:8091/swagger/.

Run tests

devtools::test()

We must start the service independently of the tests, so the tests include building the inspecter Docker image and starting/removing of a Docker container. It's recommended to build the image manually once to create a build cache.

The test relies on it's own Dockerfile at tests/testthat/Dockerfile, which reduces rebuild time to improve local development experience.

When the test fails with "too many failures", the Docker container inspecter_test must be removed manually before re-running the tests.

License

o2r muncher is licensed under Apache License, Version 2.0, see file LICENSE.

Copyright (C) 2017 - o2r project.



o2r-project/o2r-inspecter documentation built on May 12, 2019, 8:44 a.m.