blob: ff6d9270db63d6d2f81cf27f666af84ffd2b05be [file] [log] [blame]
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +02001import sys
gstepanov993c74b2015-02-05 15:20:38 +02002import os
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +02003import uuid
4import random
5import itertools
6
7from petname import Generate as pet_generate
gstepanovc4adf3b2015-02-05 16:25:48 +02008from storage_api import create_storage, TEST_PATH
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +02009
10
koder aka kdanilov98385d82015-02-04 17:09:28 +020011types = ["GA", "master"] + [pet_generate(2, '-') for _ in range(2)]
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020012random.shuffle(types)
13tp = itertools.cycle(types)
14
15sz = ["4k", "64k", "1m"]
16op_type = ["randread", "read", "randwrite", "write"]
17is_sync = ["s", "a"]
18
gstepanov993c74b2015-02-05 15:20:38 +020019
gstepanovc4adf3b2015-02-05 16:25:48 +020020storage = create_storage("file://" + TEST_PATH + "/sample.json", "", "")
koder aka kdanilov98385d82015-02-04 17:09:28 +020021combinations = list(itertools.product(op_type, is_sync, sz))
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020022
23for i in range(30):
24 row = {"build_id": pet_generate(2, " "),
25 "type": next(tp),
26 "iso_md5": uuid.uuid4().get_hex()}
27
koder aka kdanilov98385d82015-02-04 17:09:28 +020028 for sz, op_type, is_sync in combinations:
29 row[" ".join([sz, op_type, is_sync])] = (random.random() * 100,
30 random.random() * 5)
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020031
gstepanov993c74b2015-02-05 15:20:38 +020032 print len(row)
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020033 storage.store(row)