https://github.com/elixir-toniq/schism
Partition testing tool for elixir
https://github.com/elixir-toniq/schism
distributed-systems elixir erlang testing
Last synced: 6 months ago
JSON representation
Partition testing tool for elixir
- Host: GitHub
- URL: https://github.com/elixir-toniq/schism
- Owner: elixir-toniq
- License: mit
- Created: 2019-02-17T15:23:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-30T11:01:18.000Z (about 3 years ago)
- Last Synced: 2025-06-30T19:53:53.751Z (12 months ago)
- Topics: distributed-systems, elixir, erlang, testing
- Language: Elixir
- Homepage:
- Size: 62.5 KB
- Stars: 71
- Watchers: 5
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Schism
[](https://circleci.com/gh/keathley/schism)[](https://hexdocs.pm/schism/)
Schism provides a simple api for testing partitions between BEAM nodes.
Documentation: [https://hexdocs.pm/schism](https://hexdocs.pm/schism).
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `schism` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:schism, "~> 1.0", only: [:dev, :test]}
]
end
```
## Usage
Let's say that we have 5 nodes and we want to test what happens when they
disconnect from each other. We can use schism like so:
```elixir
test "netsplits" do
[n1, n2, n3, n4, n5] = nodes
# Partition our nodes
Schism.partition([n1, n3])
Schism.partition([n4])
Schism.partition([n2, n5])
# Test some stuff...
# Heal our partitions
Schism.heal([n1, n3])
Schism.heal([n2, n4, n5])
end
```
This api is useful for testing and development in conjunction with tools like
[local cluster](https://github.com/whitfin/local-cluster) and [propcheck](https://github.com/alfert/propcheck).
It is not recommended that you use this in production.
## Things Schism doesn't do
Schism's reason for existing is to quickly and easily test netsplits between BEAMS
and it uses a rudimentary trick with cookies to achieve this goal. This is great
for quickly testing your system against faults.
But because of Schism's simple nature it should not be considered a replacement
for a more robust suite of tests. It *does not* test failed TCP connections,
interleaving of messages, race-conditions, clock skew, corruption, or any of
the other issues you will see in a distributed system.