Merge lp:~longbow/kewpie/opt-matrix into lp:kewpie

Proposed by Valentine Gostev
Status: Merged
Approved by: Patrick Crews
Approved revision: no longer in the source branch.
Merged at revision: 118
Proposed branch: lp:~longbow/kewpie/opt-matrix
Merge into: lp:kewpie
Diff against target: 115 lines (+48/-2)
5 files modified
kewpie.py (+4/-1)
lib/opts/matrix_manager.py (+34/-0)
lib/opts/test_run_options.py (+7/-0)
lib/test_mgmt/execution_management.py (+2/-1)
lib/test_mgmt/test_execution.py (+1/-0)
To merge this branch: bzr merge lp:~longbow/kewpie/opt-matrix
Reviewer Review Type Date Requested Status
Patrick Crews Approve
Review via email: mp+93900@code.launchpad.net

Description of the change

Implemented matrixManager class which allows to store custom attributes
in a separate dictionary and access them from test like:
test_executor.matrix_manager.option_matrix['custom attr name']

To post a comment you must log in.
lp:~longbow/kewpie/opt-matrix updated
117. By Patrick Crews

Incorporate changes to better work with Galera replication for tests. Added convenience functions to base test case class

Revision history for this message
Patrick Crews (patrick-crews) wrote :

Looks good. This will be very useful!

review: Approve
lp:~longbow/kewpie/opt-matrix updated
118. By Patrick Crews

Merge Valentine's code for matrix manager - updates to codership / galera changes to ensure queries can execute even without an init_command

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'kewpie.py'
2--- kewpie.py 2012-02-06 18:37:56 +0000
3+++ kewpie.py 2012-02-20 20:54:17 +0000
4@@ -43,6 +43,7 @@
5 from lib.server_mgmt.server_management import serverManager
6 from lib.sys_mgmt.system_management import systemManager
7 from lib.test_mgmt.execution_management import executionManager
8+from lib.opts.matrix_manager import matrixManager
9
10 # functions
11 def handle_sys_config(input_args, defaults):
12@@ -83,6 +84,8 @@
13 execution_manager = None
14
15 try:
16+ # Instantinate option matrix
17+ matrix_manager = matrixManager(variables)
18 # Some system-level work is constant regardless
19 # of the test to be run
20 system_manager = systemManager(variables)
21@@ -99,7 +102,7 @@
22 # Initialize test execution manager
23 execution_manager = executionManager(server_manager, system_manager
24 , test_manager, test_executor
25- , variables)
26+ , variables, matrix_manager)
27
28 # Execute our tests!
29 execution_manager.execute_tests()
30
31=== added file 'lib/opts/matrix_manager.py'
32--- lib/opts/matrix_manager.py 1970-01-01 00:00:00 +0000
33+++ lib/opts/matrix_manager.py 2012-02-20 20:54:17 +0000
34@@ -0,0 +1,34 @@
35+#! /usr/bin/env python
36+# -*- mode: python; indent-tabs-mode: nil; -*-
37+# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
38+#
39+# Copyright (C) 2012 Valentine Gostev
40+#
41+# This program is free software; you can redistribute it and/or modify
42+# it under the terms of the GNU General Public License as published by
43+# the Free Software Foundation; either version 2 of the License, or
44+# (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU General Public License for more details.
50+#
51+# You should have received a copy of the GNU General Public License
52+# along with this program; if not, write to the Free Software
53+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
54+
55+"""matrix_manager.py
56+ class which imports opt-matrix option set and stores in a separate dict
57+
58+"""
59+
60+class matrixManager:
61+ def __init__(self, variables):
62+ if not variables['optmatrix']:
63+ return None
64+ matrix_list=[]
65+ for i in variables['optmatrix'].split(','):
66+ option_tuple = i.split('=')[0], i.split('=')[1]
67+ matrix_list.append(option_tuple)
68+ self.option_matrix = dict(matrix_list)
69
70=== modified file 'lib/opts/test_run_options.py'
71--- lib/opts/test_run_options.py 2012-02-03 00:40:10 +0000
72+++ lib/opts/test_run_options.py 2012-02-20 20:54:17 +0000
73@@ -217,6 +217,13 @@
74 , help="Alter the seed value provided to the random query generator to vary test runs. (string) [%default]"
75 )
76
77+ test_exec_control_group.add_option(
78+ "--opt-matrix"
79+ , dest="optmatrix"
80+ , default=''
81+ , help="Specify custom options for tests in --opt-matrix=\"option1=value1,option2=value2\" format"
82+ )
83+
84 parser.add_option_group(test_exec_control_group)
85
86 test_control_group = optparse.OptionGroup(parser,
87
88=== modified file 'lib/test_mgmt/execution_management.py'
89--- lib/test_mgmt/execution_management.py 2011-10-05 20:26:34 +0000
90+++ lib/test_mgmt/execution_management.py 2012-02-20 20:54:17 +0000
91@@ -39,10 +39,11 @@
92 """
93
94 def __init__(self, server_manager, system_manager, test_manager
95- , executor_type, variables):
96+ , executor_type, variables, matrix_manager):
97
98 self.server_manager = server_manager
99 self.system_manager = system_manager
100+ self.matrix_manager = matrix_manager
101 self.logging = system_manager.logging
102 self.test_manager = test_manager
103 if variables['verbose']:
104
105=== modified file 'lib/test_mgmt/test_execution.py'
106--- lib/test_mgmt/test_execution.py 2012-01-26 01:54:17 +0000
107+++ lib/test_mgmt/test_execution.py 2012-02-20 20:54:17 +0000
108@@ -57,6 +57,7 @@
109 self.test_manager = self.execution_manager.test_manager
110 self.server_manager = self.execution_manager.server_manager
111 self.time_manager = self.system_manager.time_manager
112+ self.matrix_manager = self.execution_manager.matrix_manager
113 self.name = name
114 self.working_environment = {} # we pass env dict to define what we need
115 self.dirset = { self.name : { 'log': None } }

Subscribers

People subscribed via source and target branches