-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.py
38 lines (29 loc) · 1.1 KB
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import argparse
import unittest
from unittest.suite import TestSuite
from runner import execute
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("--test", help = "command to execute", choices=['pvcreate','vgcreate','lvcreate'])
parser.add_argument("--disk",nargs='+', help = "disk name")
parser.add_argument('--lvname', help="name of the logical volume")
parser.add_argument('--size', help="size of the lv")
parser.add_argument('--vgname', help="volume group name to allocate lv")
args = parser.parse_args()
cmd = args.test
disk_name = args.disk
lvname = args.lvname
size = args.size
vgname = args.vgname
if __name__ == '__main__':
import test_saif
suite = TestSuite()
loader = unittest.TestLoader()
if cmd == 'pvcreate':
suite.addTests(loader.loadTestsFromName("test_saif.Task.test_pvcreate"))
if cmd == 'vgcreate':
suite.addTests(loader.loadTestsFromName("test_saif.Task.test_vgcreate"))
if cmd == 'lvcreate':
suite.addTests(loader.loadTestsFromName("test_saif.Task.test_xlvcreate"))
runner = unittest.TextTestRunner()
runner.run(suite)