r/golang
1d ago
u/BigMek_
gosim - library for simulation of file system, multi-host network and other things for reproducible tests of apps
Hey r/golang, I maintain a library which simulates a virtual filesystem, network with several hosts, timers, restarts of a computer and so on. It works inside a Go process, without cgroups, eBPF, QEMU, etc. Pure Go simulation and almost full programmatical control of the runtime.
The problem
We develop and maintain several clustered data-processing applications and libraries that are difficult to test against real-world scenarios, some of them:
latency spikes on a single host in a cluster
temporary read-only file system
run out of free space on a disk and adding free space in some time
one-way network connectivity
The library simplified dramatically and sped up some groups of test cases, no need to run tests with Docker or Kubernetes, no maintenance of proxies or virtual routers, no heavy dependencies for virtual file systems.
Additionally I added metrics for…