[autotest] make a consistent CONTROL_TYPE enum across the codebase
Prior to this CL, there were a multitude of duplicate defitions of the
two control files types (Client or Server), incluiding a difference
between the afe Job model (1 = Server) and the afe Test model (1 =
Client). This CL introduces enums CONTROL_TYPE and CONTROL_TYPE_NAMES to
control_data, to act as the central and consistent defition across the
codebase. In order to avoid needing to mangle the running Jobs table, we
have adopted the existing Job model convention (1 = Server); the Test
table will be re-written with the new consistent convention during test
import.
BUG=chromium:240643
TEST=All existing unit tests pass;
In local autotest without this patch applied, started a suite. Halfway
through suite, applied this patch, ran test importer, restarted apache,
and restarted scheduler. Suite finished successfully.
Verified manually that Client/Server type control files show up
correctly in afe Create Job view.
DEPLOY=scheduler
DEPLOY=apache
DEPLOY=test_importer
Change-Id: Ia5b2573e1d08d96b3826f2837903ef407dcae303
Reviewed-on: https://gerrit.chromium.org/gerrit/51191
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/frontend/afe/models_test.py b/frontend/afe/models_test.py
index db9f98c..04d265c 100755
--- a/frontend/afe/models_test.py
+++ b/frontend/afe/models_test.py
@@ -6,6 +6,7 @@
from autotest_lib.frontend.afe import frontend_test_utils
from autotest_lib.frontend.afe import models, model_attributes, model_logic
from autotest_lib.client.common_lib import global_config
+from autotest_lib.client.common_lib import control_data
class AclGroupTest(unittest.TestCase,
@@ -264,7 +265,7 @@
test = models.Test.objects.create(
name='name', author='author', test_class='class',
test_category='category',
- test_type=model_attributes.TestTypes.SERVER, path='path')
+ test_type=control_data.CONTROL_TYPE.SERVER, path='path')
parameterized_job = models.ParameterizedJob.objects.create(test=test)
job = self._create_job(hosts=[1], control_file=None,
parameterized_job=parameterized_job)