bbrun and iconn
bbrun says what a script does. It does not connect to anything itself: it relies on iconn, another open source framework, to open the resources of an environment.
What iconn is
iconn builds the outside world an application runs in. You describe the services your code depends on, such as an HTTP API, a database, a mail server or a queue, and for each one whether it is real or stood in for. iconn starts the stand-ins, connects to the real ones, and gives your code one object for each, with the same operations either way.
iconn has its own uses without bbrun: testing an application against a declared set of dependencies, and running a local set of stand-ins to develop against. Its source and documentation are at iconn.dev.
What iconn does under bbrun
When a script starts, bbrun reads the resources of the chosen environment and hands them to iconn. iconn gives back one open resource for each name, and every call of the script goes through it.
In bbrun.yaml | What iconn opens |
|---|---|
a resource with a baseUrl | its HTTP connector, to the real service, with the credentials of the resource |
type: sql with an engine | the database server, through its engine's driver, from a pool of connections |
type: sql without one | an embedded database, with the tables and rows of data |
type: queue | a queue in memory |
type: email | a mailbox that keeps what is sent |
type: file | a folder |
Two kinds of resources are bbrun's own: the mock (type: mock), whose
routes are bbrun expressions and scripts, and the services a program that embeds bbrun gives to
its scripts. Everything else is iconn.
When the script ends, bbrun closes what iconn opened. Each run has its own.
One idea, two levels
Both frameworks hold the same idea: code names what it uses, and the environment decides what that is.
| iconn | bbrun | |
|---|---|---|
| You write | application code, against a resource | a script, against a resource: fraudApi.post("/score", body) |
| The environment says | real or stood in for, and how to reach it | the same, in bbrun.yaml |
| It gives you | the connection | the logic on top of it: steps, checks, models, a result |
So the two are used together or apart. A team can test its application with iconn alone and never write a script. A team that writes bbrun scripts gets iconn with it and never needs to call it.
What you need to do
Nothing: iconn is inside the bbrun command. You meet it only through what
it makes possible, a resource that is a mock on your laptop and the real service in
staging, under the same name.