add etcd tests
This commit is contained in:
parent
b408e161c4
commit
42d10d3079
1 changed files with 26 additions and 0 deletions
26
test-etcd.py
Normal file
26
test-etcd.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import etcd
|
||||
import json
|
||||
|
||||
client = etcd.Client(port=2379) # this will create a client against etcd server running on localhost on port 4001
|
||||
|
||||
some_vm = {}
|
||||
some_vm['network'] = {}
|
||||
some_vm['network']['ipv6'] = []
|
||||
some_vm['network']['ipv6'].append("2a0a:e5c0:4::42/64")
|
||||
some_vm['network']['ipv6'].append("2a0a:e5c0:1::42/64")
|
||||
|
||||
|
||||
for node in range(20000):
|
||||
client.delete('/nodes/n{}'.format(node), j)
|
||||
|
||||
|
||||
for node in range(200):
|
||||
ip = some_vm['network']['ipv6'].append("2a0a:e5c0:3::{}/64".format(node))
|
||||
j = json.dumps(some_vm)
|
||||
|
||||
client.write('/nodes/n{}'.format(node), j)
|
||||
|
||||
result = client.read('/nodes', recursive=True, sorted=True)
|
||||
print(result)
|
||||
for child in result.children:
|
||||
print("%s: %s" % (child.key,child.value))
|
Loading…
Reference in a new issue