2.0 is on the way
diff --git a/tests/fake_run_test.py b/tests/fake_run_test.py
deleted file mode 100644
index eeffde3..0000000
--- a/tests/fake_run_test.py
+++ /dev/null
@@ -1,106 +0,0 @@
-import json
-import sys
-
-import run_test
-
-
-logger = run_test.logger
-tool = None
-
-
-class FakeVMContext(object):
- def __init__(self, *args, **kwargs):
- pass
-
- def __enter__(self):
- return ["fake@fake"]
-
- def __exit__(self, *args, **kwargs):
- pass
-
-
-def fake_start_vms(*args, **kwargs):
- return FakeVMContext
-
-
-class FakeFD(object):
- def __init__(self, content):
- self.content = content
- self.channel = FakeChannel()
-
- def read(self):
- return self.content
-
-
-class FakeChannel(object):
- def recv_exit_status(self):
- return 0
-
-
-def get_fake_out(cmd):
- empty_fd = FakeFD("")
- if "pgbench" == tool:
- if "run" in cmd:
- out = FakeFD("2 1:43\n2 1:42\n4 2:77")
- else:
- out = empty_fd
- elif "iozone" == tool or "fio" == tool:
- data = {'__meta__': {
- 'direct': 1,
- 'action': 'r',
- 'concurence': 1,
- 'blocksize': 1,
- 'sync': 's'},
- 'bw': 10}
- out = FakeFD(json.dumps(data))
- else:
- raise Exception("tool not found")
- err = empty_fd
- return empty_fd, out, err
-
-
-def fake_ssh_connect(*args, **kwargs):
- return FakeSSH()
-
-
-class FakeSFTP(object):
- def put(self, what, where):
- logger.debug("Called sftp put with %s %s" % (what, where))
-
- def chmod(self, f, mode):
- logger.debug("called sftp chmod %s %s" % (mode, f))
-
- def close(self):
- logger.debug("called sftp close")
-
-
-class FakeSSH(object):
- def exec_command(self, cmd, **kwargs):
- return get_fake_out(cmd)
-
- def close(self):
- pass
-
- def open_sftp(self):
- return FakeSFTP()
-
-
-class FakePopen(object):
- def __init__(self, cmd,
- shell=True,
- stdout=None,
- stderr=None,
- stdin=None):
- self.stdin, self.stdout, self.stderr = get_fake_out(cmd)
-
- def wait(self):
- return 0
-
-
-if __name__ == '__main__':
- run_test.subprocess.Popen = FakePopen
- run_test.start_test_vms = fake_start_vms()
- run_test.ssh_runner.ssh_connect = fake_ssh_connect
- opts = run_test.parse_args(sys.argv[1:])
- tool = opts.tool_type
- exit(run_test.main(sys.argv[1:]))
diff --git a/tests/test_storage.py b/tests/test_storage.py
new file mode 100644
index 0000000..46f38e6
--- /dev/null
+++ b/tests/test_storage.py
@@ -0,0 +1,53 @@
+import shutil
+import tempfile
+import contextlib
+
+
+from oktest import ok, main, test
+
+
+from wally.storage import make_storage
+
+
+@contextlib.contextmanager
+def in_temp_dir():
+ dname = tempfile.mkdtemp()
+ try:
+ yield dname
+ finally:
+ shutil.rmtree(dname)
+
+
+def test_basic():
+ with in_temp_dir() as root:
+ values = {
+ "int": 1,
+ "str/1": "test",
+ "bytes/2": b"test",
+ "none/s/1": None,
+ "bool/xx/1/2/1": None,
+ "float/s/1": 1.234,
+ "list": [1, 2, "3"],
+ "dict": {1: 3, "2": "4", "1.2": 1.3}
+ }
+
+ with make_storage(root, existing=False) as storage:
+ for path, val in values.items():
+ storage[path] = val
+
+
+ with make_storage(root, existing=True) as storage:
+ for path, val in values.items():
+ ok(storage[path]) == val
+
+
+def test_large_arrays():
+ pass
+
+
+def test_array_append():
+ pass
+
+
+def test_performance():
+ pass