These are chat archives for atomix/atomix

24th
Feb 2018
Jon Hall
@jhall11
Feb 24 2018 00:06 UTC
:+1:
Jordan Halterman
@kuujo
Feb 24 2018 00:59 UTC

The test framework can be used to setup Docker clusters:
atomix-test setup my-cluster
And add/remove nodes
atomix-test add-node -t client -c my-cluster
And run tests, now using py.test which is really cool
atomix-test run will run all test_ functions in the current working directory.

Still really buggy as I’m working out some of the Docker Networking issues wrt adding nodes to a cluster. Should be usable soon though

Can also print out cluster info:
atomix-test cluster-info my-cluster which will print out al the nodes and the host ports on which their HTTP servers are bound
➜  atomix-test git:(master) ✗ atomix-test setup foo
foo Setting up cluster
foo Creating network
foo Running container foo-1
foo Running container foo-2
foo Running container foo-3
➜  atomix-test git:(master) ✗ atomix-test add-node -t client foo
foo Adding a node to the cluster
foo Running container foo-4
➜  atomix-test git:(master) ✗ atomix-test cluster-info foo
name: foo
network:
  name: foo
  subnet: 172.18.0.0/16
  gateway: 172.18.0.1
nodes:
  foo-1:
    state: running
    type: server
    ip: 172.18.0.2
    host port: 60882
  foo-2:
    state: running
    type: server
    ip: 172.18.0.3
    host port: 60883
  foo-3:
    state: running
    type: server
    ip: 172.18.0.4
    host port: 60884
  foo-4:
    state: running
    type: client
    ip: 172.18.0.5
    host port: 60887
the IPs and ports are automatically allocated… just provide an optional subnet
Jordan Halterman
@kuujo
Feb 24 2018 01:07 UTC
basically it uses Docker as the source of truth for the cluster - labels Docker containers and inspects containers and networks to figure out which containers belong to an Atomix cluster and which IP/ports to use
and tests just use assert statements:
def test_test():
    """Test test"""
    client1 = cluster.add_node(Node.Type.CLIENT)
    log.message("Attempting to isolate node 1")
    node(1).isolate()
    log.message("Attempting to heal node 1")
    node(1).unisolate()
    log.message("Killing node 2")
    node(2).kill()
    log.message("Restarting node 2")
    node(2).start()
    log.message("Getting key")
    client1.map('foo').get('bar')
    log.message("Putting key")
    client1.map('foo').put('bar', 'baz')
    log.message("Getting key")
    assert client1.map('foo').get('bar') == 'baz'
    log.message("Removing node")
    client1.teardown()
    log.message("All done!")
Johno Crawford
@johnou
Feb 24 2018 09:07 UTC
If the assert fails it won't tear down the client?
Johno Crawford
@johnou
Feb 24 2018 19:38 UTC
Or does the framework handle tearing down the nodes if the test fails