rig 0.4.0
rig: ^0.4.0 copied to clipboard
Your tests start the containers they need. Declare a container, get a ready port.
0.4.0 #
- Container hashes are unchanged: no
ContainerSpecfield was added on this branch, so containers from 0.3.0 keep being reused instead of left behind. - New: the suite marker rule and suite database naming that modules share are
now part of
module.dart, so a module no longer carries its own copy. - Fixed: reading a suite marker no longer throws when another suite's teardown removes it at the same moment. A marker that has gone means what an absent one means.
0.3.0 #
pruneContainers()— the decision logic behindrig prunemoved fromrig_cliintorigitself, and is now exported fromrig.dart. A project that added only a module such asrig_postgres, and never addedrig_cli, previously had no way to clean up at all; now it can callpruneContainers()directly. It returns aPruneResultrather than printing —rig_cli'srig prunecommand now just formats it.alldefaults tofalsefor the same reason it always has, stated more bluntly here than in the CLI's--allhelp: a container this removes is certainly in use by something, possibly a suite in a different project entirely, since containers are shared across project boundaries.
0.2.0 #
-
Containers from 0.1.0 are not reused. Adding a field to
ContainerSpecchanges every configuration hash, so the first run on this version creates fresh containers and leaves the old ones behind.rig pruneclears them. -
ContainerSpec.filesplaces files inside the container before it starts, for a server that reads its configuration at startup — too late forContainerLease.putFile, and unlike a bind mount, without the host's ownership coming along for the ride. EachContainerFilecarries its ownmode,uid, andgid;uid/gidmust be numeric ids, since Docker ignores a tar entry's user/group name. Only the file itself is ever written — never a directory entry for its parents, which would overwrite an existing directory's own mode and owner. Folded into the configuration hash by path, mode, uid, gid, and content, the same way a mount's content is; two files at the same path throw rather than silently picking a winner.
0.1.0 #
First release.
useContainer(spec)declares the container a test suite needs. rig starts it if nobody has, waits until it is usable, and hands back the host port Docker assigned.- Suites asking for the same configuration share one container, which is
the default rather than an opt-in.
dart testgives every test file its own isolate, so the coordination lives in Docker labels and a lock on disk rather than in a process-wide singleton. - Wait strategies:
WaitFor.healthy,WaitFor.port,WaitFor.httpOk,WaitFor.logMessageandWaitFor.all. A strategy is pure data, so a spec stays const-constructible and can be hashed. ContainerSpec.healthcheckinjects a healthcheck into an image that ships none, which is most of them.- Mounted files are folded into the configuration hash by content, not by path, so replacing a mounted certificate stops matching the container that is still serving the old one.
ContainerLease.execruns a command in the container and throwsExecFailedon a non-zero exit unless you ask otherwise.ContainerLease.logTailreads the log.Lifetime.dedicatedopts a suite out of sharing.- Talks to the Docker Engine API over its Unix socket directly. No Docker CLI,
and no dependency beyond
crypto,meta,pathandtest. - Containers are deliberately left running between runs.
rig_cliprovides therigcommand to list and remove them. ContainerBuild.contextmay contain a.dockerignore; rig interprets it client-side before sending the build context, since the daemon does not. The file named byContainerBuild.dockerfileis always sent even if.dockerignoreexcludes it. A pattern rig cannot interpret (currently a character class such as[a-z]) throws rather than being sent anyway.StateDir.markerDir(kind)replacesStateDir.suitesDir: every module that records what it holds inside a container now files its markers undermarkers/<kind>/<containerId>/<name>, sorig prunecan sweep them all without knowing what any kind means.kindis validated as a plain lowercase token (letters, digits,_,-) so it cannot be used to escape the state directory as a path segment.