summaryrefslogtreecommitdiffstats
path: root/populate-db.py
blob: 1fbd327162ffe3bd160aa9373cdee21b1b90595b (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
# -*- coding: utf-8 -*-
"""Setup the israwhidebroken database with some initial values"""

import sys
from os import getcwd
from os.path import dirname, exists, join

# Enumerate the basic test cases defined in the test plan (see URL)
# https://fedoraproject.org/wiki/QA:Rawhide_Acceptance_Test_Plan#Test_Cases
rats_tests = [
('Repodata validity',
 'Checks that the yum metadata for a given repository is valid',
 'http://fedoraproject.org/wiki/QA:Repodata_validity_test_case'),

('comps.xml validity',
 'Verifies that comps.xml is usable by the installer and other system tools',
 'http://fedoraproject.org/wiki/QA:Comps_Validity_Test_Case'),

('Core package dependency closure',
 'Ensure that the Critical Path Packages have no conflicts or missing deps',
 'http://fedoraproject.org/wiki/QA:Core_package_dependency_closure_test_case'),

('Core package existence',
 'Ensure that the Critical Path Packages are present and not corrupted',
 'http://fedoraproject.org/wiki/QA:Core_package_existence_test_case'),

('Installer image existence',
 'Check that installer images and metadata are present and not corrupt',
 'http://fedoraproject.org/wiki/QA:Installer_image_presence_test_case'),

('Kernel boot',
 'Check that the installer kernel boots',
 'http://fedoraproject.org/wiki/QA:Kernel_simple_boot_test_case'),

('Anaconda loader fetching stage2',
 'Ensure that anaconda\'s first stage can fetch stage2 (install.img)',
 'http://fedoraproject.org/wiki/QA:Anaconda_stage2_fetch_test_case'),

('Anaconda stage2 disk probe',
 'Check that anaconda can detect the presence of disk devices',
 'http://fedoraproject.org/wiki/QA:Anaconda_storage_probe_test_case'),

('X startup/basic display configuration',
 'Check that Xorg can detect and configure the video controller and monitor',
 'http://fedoraproject.org/wiki/QA:X_basic_display_test_case'),

('X basic input handling',
 'Ensure that the X server can receive and process input',
 'http://fedoraproject.org/wiki/QA:X_basic_input_handling_test_case'),

('Basic network connectivity',
 'A very simple networking test',
 'http://fedoraproject.org/wiki/QA:Network_basic_test_case'),

('yum update functionality',
 'A very simple check of \'yum update\' functionality',
 'http://fedoraproject.org/wiki/QA:Yum_simple_update_test_case'),
]

def setup_database():
    # Load the models
    from israwhidebroken import model

    # Add tests to the test table
    for (n, sd, u) in rats_tests:
        exists = model.Test.select(model.Test.q.name==n)
        if exists.count() == 0:
            print "adding Test(%s)" % n
            test = model.Test(name=n, short_desc=sd, uri=u)
        else:
            print "Test(%s) already exists" % n
    model.hub.commit()

    # TODO: add a couple of example trees / results

    print "Successfully setup"

if __name__ == '__main__':
    import turbogears
    setupdir = dirname(__file__)
    curdir = getcwd()
    if len(sys.argv) > 1:
        configfile = sys.argv[1]
    elif exists(join(setupdir, "setup.py")):
        configfile = join(setupdir, "dev.cfg")
    elif exists(join(curdir, "prod.cfg")):
        configfile = join(curdir, "prod.cfg")
    print "using config %s" % configfile
    turbogears.update_config(configfile=configfile,
                             modulename="israwhidebroken.config")
    setup_database()