4 from distchanges.cmd import Changes
6 CHANGE_ID = 'Ic96517f4a57fe547d42495274a74ec5aa32b7d9e'
7 REMOTE_URL = 'ssh://git.opendaylight.org:29418'
9 PROJECT_NAMES = ['genius', 'mdsal', 'netvirt', 'neutron', 'openflowjava', 'openflowplugin', 'ovsdb', 'yangtools']
13 DISTRO_PATH = "/home/shague/data/images/official/distribution-karaf-0.6.0-20170109.201555-2968/distribution-karaf-0.6.0-SNAPSHOT"
14 PROPERTIES_FILE = "/home/shague/data/images/official/distribution-karaf-0.6.0-20170109.201555-2968/distribution-karaf-0.6.0-SNAPSHOT/system/org/opendaylight/netvirt/aclservice-api/0.4.0-SNAPSHOT/aclservice-api-0.4.0-SNAPSHOT.jar"
17 class TestChangesOld(unittest.TestCase):
21 for project in 'netvirt', 'genius':
23 for line in open('changes.' + project + '.10.json.txt'):
24 if line.find('stats') == -1:
26 cls.json[project] = json
29 print("Starting test: %s" % self.id())
31 def test_get_sub_time(self):
32 self.assertEquals(1483974872, changes.get_subm_time(self.json['netvirt'][0]))
34 def test_get_sub_time_10(self):
35 for line in self.json['netvirt']:
36 self.assertNotEquals(0, changes.get_subm_time(line))
38 def test_get_sub_time_fail(self):
39 self.assertEquals(0, changes.get_subm_time('this is a bad json file'))
41 def test_get_gerrit(self):
42 gerrits = changes.get_gerrits(REMOTE_URL, 'netvirt', 'master', CHANGE_ID, 1)
43 for gerrit in gerrits:
44 print("gerrit: %s" % str(gerrit))
46 def test_get_gerrits(self):
47 for project in PROJECT_NAMES:
48 gerrits = changes.get_gerrits(REMOTE_URL, project, 'master', limit=10)
49 for gerrit in gerrits:
50 print("gerrit: %s %s" % (project, str(gerrit)))
52 def test_get_gitproperties_file(self):
53 pfile = changes.extract_gitproperties_file(PROPERTIES_FILE)
54 self.assertNotEqual(None, pfile)
56 def test_get_changeid_from_properties(self):
57 pfile = changes.extract_gitproperties_file(PROPERTIES_FILE)
58 self.assertNotEqual(None, pfile)
59 self.assertNotEqual(None, changes.get_changeid_from_properties(pfile))
61 def test_get_build_changeid(self):
62 self.assertNotEqual(None, changes.find_distro_changeid(DISTRO_PATH, 'netvirt'))
64 def test_run_cmd_master(self):
65 # project_names = PROJECT_NAMES
66 project_names = ['openflowplugin']
67 # project_names = ['netvirt']
68 changes = Changes(BRANCH, DISTRO_PATH, LIMIT, QLIMIT, project_names, REMOTE_URL)
69 projects = changes.run_cmd()
70 changes.pretty_print_projects(projects)
72 if __name__ == '__main__':