summaryrefslogtreecommitdiffstats
path: root/src/software/test/test_software_installation_service.py
blob: e2351b0be567ea7de5ebb0b87de5717004f8805c (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
#!/usr/bin/env python
#
# Copyright (C) 2012-2014 Red Hat, Inc.  All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
# Authors: Michal Minar <miminar@redhat.com>
# Authors: Jan Grec <jgrec@redhat.com>
#
"""
Unit tests for ``LMI_SoftwareInstallationService`` provider.
"""

import pywbem
import time
import unittest

from lmi.test.lmibase import enable_lmi_exceptions
import package
import swbase
import util

CHECK_SOFTWARE_IDENTITY_NOT_SUPPORTED = 1
COMMUNICATION_STATUS_NOT_AVAILABLE = 1
COMMUNICATION_STATUS_OK = 2
DETAILED_STATUS_NOT_AVAILABLE = 0
ENABLED_DEFAULT_ENABLED = 2
ENABLED_DEFAULT_NOT_APPLICABLE = 5
ENABLED_STATE_ENABLED = 2
ENABLED_STATE_NOT_APPLICABLE = 5
FIND_IDENTITY_FOUND = 0
FIND_IDENTITY_NO_MATCH = 1
HEALTH_STATE_OK = 5
INSTALL_FROM_BYTE_STREAM_NOT_SUPPORTED = 1
INSTALL_OPTIONS_FORCE = 3
INSTALL_OPTIONS_INSTALL = 4
INSTALL_OPTIONS_UPDATE = 5
INSTALL_OPTIONS_REPAIR = 6
INSTALL_OPTIONS_UNINSTALL = 9
OPERATING_STATUS_SERVICING = 2
OPERATIONAL_STATUS_OK = 2
PRIMARY_STATUS_OK = 1
REQUESTED_STATE_NOT_APPLICABLE = 12
TRANSITIONING_TO_STATE_NOT_APPLICABLE = 12

JOB_COMPLETED_WITH_NO_ERROR = 0
UNSPECIFIED_ERROR = 2
INVALID_PARAMETER = 5
METHOD_PARAMETERS_CHECKED_JOB_STARTED = 4096

class TestSoftwareInstallationService(swbase.SwTestCase):
    """
    Basic cim operations test on ``LMI_SoftwareInstallationService``.
    """

    CLASS_NAME = "LMI_SoftwareInstallationService"
    KEYS = ("CreationClassName", "Name", "SystemCreationClassName",
            "SystemName")

    def make_op(self):
        """
        :returns: Object path of ``LMI_SoftwareInstallationService``
        :rtype: :py:class:`lmi.shell.LMIInstanceName`
        """
        return self.cim_class.new_instance_name({
            "Name" : 'LMI:' + self.CLASS_NAME,
            "SystemName" : self.SYSTEM_NAME,
            "SystemCreationClassName" : self.system_cs_name,
            "CreationClassName" : self.CLASS_NAME
        })

    def test_get_instance(self):
        """
        Test ``GetInstance()`` call on ``LMI_SoftwareInstallationService``.
        """
        objpath = self.make_op()
        inst = objpath.to_instance()
        self.assertNotEqual(inst, None)
        self.assertCIMNameEqual(inst.path, objpath)
        for key_property in objpath.key_properties():
            if key_property == 'SystemName':
                self.assertIn(inst.SystemName, (self.SYSTEM_NAME, 'localhost'))
            else:
                self.assertEqual(getattr(inst, key_property),
                        getattr(objpath, key_property))
        self.assertGreater(len(inst.Caption), 0)
        self.assertEqual(inst.CommunicationStatus,
                COMMUNICATION_STATUS_NOT_AVAILABLE)
        self.assertGreater(len(inst.Description), 0)
        self.assertEqual(inst.DetailedStatus, DETAILED_STATUS_NOT_AVAILABLE)
        self.assertEqual(inst.EnabledDefault, ENABLED_DEFAULT_NOT_APPLICABLE)
        self.assertEqual(inst.EnabledState, ENABLED_STATE_NOT_APPLICABLE)
        self.assertEqual(inst.HealthState, HEALTH_STATE_OK)
        self.assertEqual(inst.InstanceID, "LMI:" + self.CLASS_NAME)
        self.assertEqual(inst.OperatingStatus, OPERATING_STATUS_SERVICING)
        self.assertEqual(inst.OperationalStatus, [OPERATIONAL_STATUS_OK])
        self.assertEqual(inst.PrimaryStatus, PRIMARY_STATUS_OK)
        self.assertEqual(inst.RequestedState, REQUESTED_STATE_NOT_APPLICABLE)
        self.assertTrue(inst.Started)
        self.assertEqual(inst.TransitioningToState, 12)

    def test_enum_instance_names(self):
        """
        Test ``EnumerateInstanceNames()`` call on
        ``LMI_SoftwareInstallationService``.
        """
        objpath = self.make_op()
        insts = self.cim_class.instance_names()
        self.assertEqual(len(insts), 1)
        inst = insts[0]
        self.assertCIMNameEqual(inst, objpath)

    def test_enum_instances(self):
        """
        Test ``EnumerateInstances()`` call on
        ``LMI_SoftwareInstallationService``.
        """
        objpath = self.make_op()
        insts = self.cim_class.instances()
        self.assertEqual(len(insts), 1)
        inst = insts[0]
        self.assertCIMNameEqual(inst.path, objpath)
        self.assertEqual(inst.InstanceID, "LMI:" + self.CLASS_NAME)

    @enable_lmi_exceptions
    def test_check_software_identity_method(self):
        """
        Try to invoke ``CheckSoftwareIdentity()`` method which shall not be
        supported.
        """
        service = self.make_op().to_instance()
        # TODO: This should either return NOT_SUPPORTED or
        # InstallFromByteStream() should raise the same.
        # This dissimilarity is really weird.
        self.assertRaisesCIM(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE,
                service.CheckSoftwareIdentity)

    @enable_lmi_exceptions
    def test_install_from_byte_stream_method(self):
        """
        Try to invoke ``InstallFromByteStram()`` method which shall not be
        supported.
        """
        service = self.make_op().to_instance()
        # TODO: This should either raise METHOD_NOT_AVAILABLE or
        # CheckSoftwareIdentity() should return NOT_SUPPORTED.
        # This dissimilarity is really weird.
        rval, _, _ = service.InstallFromByteStream()
        self.assertEqual(rval, INSTALL_FROM_BYTE_STREAM_NOT_SUPPORTED)

    @swbase.test_with_repos(**{
        'stable' : True,
        'updates-testing' : True,
        'updates' : False,
        'misc' : False,
    })
    @swbase.test_with_packages(**{
        'stable#pkg1' : True,
        'pkg2' : False,
        'pkg3' : False,
        'pkg4' : False,
        'misc#*' : False,
    })
    def test_query_identities_by_name(self):
        """
        Try to find packages by their name.
        """
        service = self.make_op().to_instance()

        # allow duplicates is False
        rval, oparms, _ = service.FindIdentity(Name="openlmi-sw-test")
        self.assertEqual(rval, FIND_IDENTITY_FOUND)
        self.assertIn("Matches", oparms)
        inames = oparms["Matches"]
        # pkg1 is listed twice (installed and available version)
        # pkg2, pkg3 and pkg4 just once (the newest version)
        self.assertEqual(len(inames), 5)
        nevra_set = set()
        for iname in inames:
            self.assertEqual(iname.classname, 'LMI_SoftwareIdentity')
            self.assertEqual(iname.key_properties(), ['InstanceID'])
            self.assertTrue(iname.InstanceID.startswith(
                'LMI:LMI_SoftwareIdentity'))
            nevra_set.add(iname.InstanceID[len('LMI:LMI_SoftwareIdentity:'):])
        for repoid in ('stable', 'updates-testing'):
            for pkg in self.get_repo(repoid).packages:
                if pkg.name.endswith('pkg2') and repoid == 'stable':
                    # only pkg2 from updates-tesing will be present (its newer)
                    continue
                self.assertIn(pkg.nevra, nevra_set)
                nevra_set.remove(pkg.nevra)
        self.assertEqual(len(nevra_set), 0)

        rval, oparms, _ = service.FindIdentity(Name="openlmi-sw-test",
                AllowDuplicates=True)
        self.assertEqual(rval, FIND_IDENTITY_FOUND)
        inames = oparms["Matches"]
        self.assertEqual(len(inames), 6)
        nevra_set = set()
        for iname in inames:
            nevra_set.add(iname.InstanceID[len('LMI:LMI_SoftwareIdentity:'):])
        for repoid in ('stable', 'updates-testing'):
            for pkg in self.get_repo(repoid).packages:
                self.assertIn(pkg.nevra, nevra_set)
                nevra_set.remove(pkg.nevra)
        self.assertEqual(len(nevra_set), 0)

    @swbase.test_with_repos('stable', 'updates', 'updates-testing', 'misc')
    def test_query_not_existing_package_by_name(self):
        """
        Try to find package by part of name with exact match.
        """
        service = self.make_op().to_instance()
        rval, oparms, _ = service.FindIdentity(Name="openlmi-sw-test",
                ExactMatch=True)
        self.assertEqual(rval, FIND_IDENTITY_NO_MATCH)
        self.assertIn("Matches", oparms)
        inames = oparms["Matches"]
        self.assertEqual(len(inames), 0)

    @swbase.test_with_repos('stable', 'updates', 'updates-testing', 'misc')
    @swbase.test_with_packages(**{'pkg2' : False})
    def test_query_identity_by_name_exact(self):
        """
        Try to find package by name with exact match.
        """
        service = self.make_op().to_instance()

        # allow duplicates is False
        rval, oparms, _ = service.FindIdentity(Name="openlmi-sw-test-pkg2",
                ExactMatch=True)
        self.assertEqual(rval, FIND_IDENTITY_FOUND)
        self.assertIn("Matches", oparms)
        inames = oparms["Matches"]
        # there are two different architectures available
        self.assertEqual(len(inames), 2)
        nevra_set = set(   i.InstanceID[len('LMI:LMI_SoftwareIdentity:'):]
                       for i in inames)
        self.assertIn(self.get_repo('updates-testing')['pkg2'].nevra, nevra_set)
        self.assertIn(self.get_repo('misc')['pkg2'].nevra, nevra_set)

        # allow duplicates is True
        rval, oparms, _ = service.FindIdentity(Name="openlmi-sw-test-pkg2",
                AllowDuplicates=True,
                ExactMatch=True)
        self.assertEqual(rval, FIND_IDENTITY_FOUND)
        self.assertIn("Matches", oparms)
        inames = oparms["Matches"]
        self.assertEqual(len(inames), 4)
        nevra_set = set(   i.InstanceID[len('LMI:LMI_SoftwareIdentity:'):]
                       for i in inames)
        for repo in self.repodb.values():
            pkg = repo['pkg2']
            self.assertIn(pkg.nevra, nevra_set)
            nevra_set.remove(pkg.nevra)
        self.assertEqual(len(nevra_set), 0)

    @swbase.test_with_repos('stable', 'updates', 'updates-testing', 'misc')
    def test_query_identity_by_repoid(self):
        """
        Try to filter packages by repository.
        """
        service = self.make_op().to_instance()
        repo = self.get_repo('misc')
        repo_iname = self.ns.LMI_SoftwareIdentityResource.new_instance_name({
            "Name" : repo.repoid,
            "SystemName" : self.SYSTEM_NAME,
            "SystemCreationClassName" : self.system_cs_name,
            "CreationClassName" : "LMI_SoftwareIdentityResource"
        })
        rval, oparms, _ = service.FindIdentity(Repository=repo_iname)
        self.assertEqual(rval, FIND_IDENTITY_FOUND)
        self.assertIn("Matches", oparms)
        inames = oparms['Matches']
        self.assertEqual(len(inames), len(repo.packages))
        nevra_set = set(   i.InstanceID[len('LMI:LMI_SoftwareIdentity:'):]
                       for i in inames)
        for pkg in repo.packages:
            self.assertIn(pkg.nevra, nevra_set)
            nevra_set.remove(pkg.nevra)
        self.assertEqual(len(nevra_set), 0)

    @swbase.test_with_repos(**{'stable' : False, 'misc' : False})
    @swbase.test_with_packages('stable#pkg1')
    def test_query_installed_package_by_nevra(self):
        """
        Try to find installed, not available package by its nevra.
        """
        service = self.make_op().to_instance()
        pkg = self.get_repo('stable')['pkg1']
        rval, oparms, _ = service.FindIdentity(
                Name=pkg.name,
                Epoch=pkg.epoch,
                Version=pkg.ver,
                Release=pkg.rel,
                Architecture=pkg.arch,
                AllowDuplicates=True,
                ExactMatch=True)
        self.assertEqual(rval, FIND_IDENTITY_FOUND)
        self.assertIn("Matches", oparms)
        inames = oparms['Matches']
        self.assertEqual(len(inames), 1)
        self.assertTrue(inames[0].InstanceID.endswith(pkg.nevra))

    @swbase.test_with_repos('stable', 'updates', 'updates-testing', 'misc')
    def test_query_package_by_arch(self):
        """
        Try to find package filtered by arch.
        """
        service = self.make_op().to_instance()
        pkg = self.get_repo('misc')['pkg2']
        rval, oparms, _ = service.FindIdentity(
                Name='openlmi-sw-test',
                Architecture=pkg.arch,
                AllowDuplicates=True)
        self.assertEqual(rval, FIND_IDENTITY_FOUND)
        self.assertIn("Matches", oparms)
        inames = oparms['Matches']
        self.assertEqual(len(inames), 1)
        self.assertTrue(inames[0].InstanceID.endswith(pkg.nevra))

    @swbase.test_with_repos('stable')
    @swbase.test_with_packages(**{ 'pkg1' : False })
    def test_install_package_sync(self):
        """
        Try to synchronously install package.
        """
        pkg = self.get_repo('stable')['pkg1']
        self.assertFalse(package.is_pkg_installed(pkg))
        service = self.make_op().to_instance()
        rval, oparms, _ = service.SyncInstallFromSoftwareIdentity(
                Source=util.make_pkg_op(self.ns, pkg),
                InstallOptions=[INSTALL_OPTIONS_INSTALL],
                Target=self.system_iname)
        self.assertEqual(rval, JOB_COMPLETED_WITH_NO_ERROR)
        self.assertEqual(len(oparms), 0)
        self.assertTrue(package.is_pkg_installed(pkg))

    @swbase.test_with_repos('stable')
    @swbase.test_with_packages('stable#pkg1')
    def test_remove_package_sync(self):
        """
        Try to synchronously remove package.
        """
        pkg = self.get_repo('stable')['pkg1']
        self.assertTrue(package.is_pkg_installed(pkg))
        service = self.make_op().to_instance()
        rval, oparms, _ = service.SyncInstallFromSoftwareIdentity(
                Source=util.make_pkg_op(self.ns, pkg),
                InstallOptions=[INSTALL_OPTIONS_UNINSTALL],
                Target=self.system_iname)
        self.assertEqual(rval, JOB_COMPLETED_WITH_NO_ERROR)
        self.assertTrue(  len(oparms) == 0
                       or ('Job' in oparms and oparms['Job'] is None))
        self.assertFalse(package.is_pkg_installed(pkg))

    @swbase.test_with_repos('stable', 'updates')
    @swbase.test_with_packages('stable#pkg1')
    def test_update_package_sync(self):
        """
        Try to synchronously update package.
        """
        pkg = self.get_repo('stable')['pkg1']
        self.assertTrue(package.is_pkg_installed(pkg))
        service = self.make_op().to_instance()
        rval, oparms, _ = service.SyncInstallFromSoftwareIdentity(
                Source=util.make_pkg_op(self.ns, pkg),
                InstallOptions=[INSTALL_OPTIONS_UPDATE],
                Target=self.system_iname)
        self.assertEqual(rval, JOB_COMPLETED_WITH_NO_ERROR)
        self.assertTrue(  len(oparms) == 0
                       or ('Job' in oparms and oparms['Job'] is None))
        self.assertFalse(package.is_pkg_installed(pkg))
        up_pkg = self.get_repo('updates')['pkg1']
        self.assertTrue(package.is_pkg_installed(up_pkg))

    @swbase.test_with_repos('stable', 'updates')
    @swbase.test_with_packages(**{'pkg1' : False})
    def test_update_not_installed_package_sync(self):
        """
        Try to synchronously update package which is not installed.
        """
        pkg = self.get_repo('stable')['pkg1']
        self.assertFalse(package.is_pkg_installed(pkg.name))
        service = self.make_op().to_instance()
        rval, oparms, error = service.SyncInstallFromSoftwareIdentity(
                Source=util.make_pkg_op(self.ns, pkg),
                InstallOptions=[INSTALL_OPTIONS_UPDATE],
                Target=self.system_iname)
        self.assertEqual(rval, INVALID_PARAMETER)
        self.assertGreater(len(error), 0)
        self.assertTrue(  len(oparms) == 0
                       or ('Job' in oparms and oparms['Job'] is None))
        self.assertFalse(package.is_pkg_installed(pkg.name))

    @enable_lmi_exceptions
    @swbase.test_with_repos('stable')
    @swbase.test_with_packages(**{ 'pkg1' : False })
    def test_install_method_sync_without_target_and_collection(self):
        """
        Try to synchronously install package without target and collection
        parameters given.

        Software Update profile says that ``InstallFromSoftwareIdentity``
        shall return ``UNSPECIFIED_ERROR``. Which is really weird since the
        error is known.
        """
        pkg = self.get_repo('stable')['pkg1']
        self.assertFalse(package.is_pkg_installed(pkg))
        service = self.make_op().to_instance()
        for opts in (
                [INSTALL_OPTIONS_INSTALL],
                [INSTALL_OPTIONS_UNINSTALL],
                [INSTALL_OPTIONS_UPDATE]):
            rval, oparms, _ = service.SyncInstallFromSoftwareIdentity(
                    Source=util.make_pkg_op(self.ns, pkg),
                    InstallOptions=opts)
            self.assertEqual(rval, UNSPECIFIED_ERROR)
            self.assertTrue(  len(oparms) == 0
                           or ('Job' in oparms and oparms['Job'] is None))

    @swbase.test_with_repos('stable')
    @swbase.test_with_packages(**{ 'pkg1' : False })
    def test_install_package_sync_with_target_and_collection(self):
        """
        Try to synchronously install package with target and collection
        parameters omitted.

        Software Update profile says that ``InstallFromSoftwareIdentity``
        shall return ``UNSPECIFIED_ERROR``. Which is really weird since the
        error is known.
        """
        pkg = self.get_repo('stable')['pkg1']
        self.assertFalse(package.is_pkg_installed(pkg))
        service = self.make_op().to_instance()
        for opts in (
                [INSTALL_OPTIONS_INSTALL],
                [INSTALL_OPTIONS_UNINSTALL],
                [INSTALL_OPTIONS_UPDATE]):
            rval, oparms, _ = service.SyncInstallFromSoftwareIdentity(
                    Source=util.make_pkg_op(self.ns, pkg),
                    InstallOptions=opts,
                    Target=self.system_iname,
                    Collection=self.ns.LMI_SystemSoftwareCollection \
                        .new_instance_name({
                            "InstanceID" : "LMI:LMI_SystemSoftwareCollection"
                        }))
            self.assertEqual(rval, UNSPECIFIED_ERROR)
            self.assertTrue(  len(oparms) == 0
                           or ('Job' in oparms and oparms['Job'] is None))

    @swbase.test_with_repos('stable')
    @swbase.test_with_packages(**{ 'pkg1' : False })
    def test_install_package_sync_with_collection(self):
        """
        Try to synchronously install package with just collection given.
        """
        pkg = self.get_repo('stable')['pkg1']
        self.assertFalse(package.is_pkg_installed(pkg))
        service = self.make_op().to_instance()
        rval, oparms, _ = service.SyncInstallFromSoftwareIdentity(
                Source=util.make_pkg_op(self.ns, pkg),
                InstallOptions=[INSTALL_OPTIONS_INSTALL],
                Collection=self.ns.LMI_SystemSoftwareCollection \
                        .new_instance_name({
                            "InstanceID" : "LMI:LMI_SystemSoftwareCollection"
                        }))
        self.assertEqual(rval, JOB_COMPLETED_WITH_NO_ERROR)
        self.assertTrue(  len(oparms) == 0
                       or ('Job' in oparms and oparms['Job'] is None))
        self.assertTrue(package.is_pkg_installed(pkg))

    @swbase.test_with_repos('stable')
    @swbase.test_with_packages('stable#pkg1')
    def test_reinstall_package(self):
        """
        Try to reinstall package.
        """
        pkg = self.get_repo('stable')['pkg1']
        pkg_op = util.make_pkg_op(self.ns, pkg)
        inst = pkg_op.to_instance()
        install_date = inst.InstallDate
        self.assertTrue(package.is_pkg_installed(pkg))

        service = self.make_op().to_instance()
        time.sleep(1)
        rval, oparms, _ = service.SyncInstallFromSoftwareIdentity(
                Source=pkg_op,
                InstallOptions=[INSTALL_OPTIONS_INSTALL, INSTALL_OPTIONS_FORCE],
                Target=self.system_iname)
        self.assertEqual(rval, JOB_COMPLETED_WITH_NO_ERROR)
        self.assertTrue(  len(oparms) == 0
                       or ('Job' in oparms and oparms['Job'] is None))
        self.assertTrue(package.is_pkg_installed(pkg))
        inst.refresh()
        install_date2 = inst.InstallDate
        self.assertGreater(install_date2, install_date)

def suite():
    """For unittest loaders."""
    return unittest.TestLoader().loadTestsFromTestCase(
            TestSoftwareInstallationService)

if __name__ == '__main__':
    unittest.main()