Skip to content
Ryo Okubo edited this page Aug 28, 2016 · 5 revisions

Design

API/Library stacks

ts_mruby calls atscppapi, wrapped TS API by C++ classes basically.

stack

Server hook usage

Apache Traffic Server supports various hooks. ts_mruby uses READ_REQUEST_HDR_HOOK mainly and response body transform if necessary. other hooks are unsupported yet.

hooks

Thread shared/local Data

All of thread share mruby scirpts as string. And each thread has own mruby VM(mrb_state) and RProc's poinging to compiled code. Thread and data

Testing

ts_mruby has unittest and functional test.

Unit test

  • test/ is a directory for unit test code.
  • Using googletest and googlemock as testing framework.
  • Add virtual qualifier to enable mocking when only compiling test code.
  • Implement empty atscppapi methods to avoid redundant linking to libatscppapi.so

Functional test

  • spec/ is a directory for functional test code.
  • Run ATS with ts_mruby and simple mruby scripts.
  • And generate HTTP requests to the ATS to examine whether responses is expected.
  • Using capybara to headless test and factory_girl as a fixture replacement.
Clone this wiki locally