Fix loads of pycodestyle issues in test_autopkgtest

ubuntu/rebased
Paul Gevers 6 years ago
parent 7611231ee2
commit e8b5f5e631
No known key found for this signature in database
GPG Key ID: 9C5C99EB05BD750A

@ -29,6 +29,7 @@ apt_pkg.init()
def tr(s):
return {'custom_environment': ['ADT_TEST_TRIGGERS=%s' % s]}
ON_ALL_ARCHES = {'on-architectures': ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el'],
'on-unimportant-architectures': []}
@ -1024,24 +1025,24 @@ class T(TestBase):
self.assertEqual(self.pending_requests, {})
self.assertEqual(self.amqp_requests, set())
### def test_same_version_binary_in_unstable(self):
### '''binary from new architecture in unstable with testing version'''
###
### # Invalid dataset in Debian and Ubuntu: ... ARCHITECTURE all != i386
### self.data.add('lightgreen', False)
###
### # i386 is in testing already, but amd64 just recently built and is in unstable
### self.data.add_src('brown', False, {'Testsuite': 'autopkgtest'})
### self.data.add_src('brown', True, {'Testsuite': 'autopkgtest'})
### self.data.add('brown', False, {'Architecture': 'i386'}, add_src=False)
### self.data.add('brown', True, {}, add_src=False)
###
### exc = self.run_it(
### # we need some other package to create unstable Sources
### [('lightgreen', {'Version': '2'}, 'autopkgtest')],
### {'brown': (True, {})}
### )[1]
### self.assertEqual(exc['brown']['item-name'], 'brown/amd64')
# # def test_same_version_binary_in_unstable(self):
# # '''binary from new architecture in unstable with testing version'''
# #
# # # Invalid dataset in Debian and Ubuntu: ... ARCHITECTURE all != i386
# # self.data.add('lightgreen', False)
# #
# # # i386 is in testing already, but amd64 just recently built and is in unstable
# # self.data.add_src('brown', False, {'Testsuite': 'autopkgtest'})
# # self.data.add_src('brown', True, {'Testsuite': 'autopkgtest'})
# # self.data.add('brown', False, {'Architecture': 'i386'}, add_src=False)
# # self.data.add('brown', True, {}, add_src=False)
# #
# # exc = self.run_it(
# # # we need some other package to create unstable Sources
# # [('lightgreen', {'Version': '2'}, 'autopkgtest')],
# # {'brown': (True, {})}
# # )[1]
# # self.assertEqual(exc['brown']['item-name'], 'brown/amd64')
def test_package_pair_running(self):
'''Two packages in unstable that need to go in together (running)'''
@ -1554,30 +1555,30 @@ class T(TestBase):
self.assertEqual(self.pending_requests, {})
self.assertEqual(self.amqp_requests, set())
### def test_multiarch_dep(self):
### '''multi-arch dependency'''
### # needs changes in britney2/installability/builder.py
###
### self.data.add_default_packages(lightgreen=False)
###
### # lightgreen has passed before on i386 only, therefore ALWAYSFAIL on amd64
### self.swift.set_results({'autopkgtest-testing': {
### 'testing/i386/l/lightgreen/20150101_100000@': (0, 'lightgreen 1', tr('passedbefore/1')),
### }})
###
### self.data.add('rainbow', False, {'Depends': 'lightgreen:any'},
### testsuite='autopkgtest')
### self.data.add('rainbow', True, {'Depends': 'lightgreen:any'},
### testsuite='autopkgtest')
###
### self.run_it(
### [('lightgreen', {'Version': '2'}, 'autopkgtest')],
### {'lightgreen': (False, {'lightgreen': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING'},
### 'rainbow': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
### }),
### },
### {'lightgreen': [('old-version', '1'), ('new-version', '2')]}
### )
# # def test_multiarch_dep(self):
# # '''multi-arch dependency'''
# # # needs changes in britney2/installability/builder.py
# #
# # self.data.add_default_packages(lightgreen=False)
# #
# # # lightgreen has passed before on i386 only, therefore ALWAYSFAIL on amd64
# # self.swift.set_results({'autopkgtest-testing': {
# # 'testing/i386/l/lightgreen/20150101_100000@': (0, 'lightgreen 1', tr('passedbefore/1')),
# # }})
# #
# # self.data.add('rainbow', False, {'Depends': 'lightgreen:any'},
# # testsuite='autopkgtest')
# # self.data.add('rainbow', True, {'Depends': 'lightgreen:any'},
# # testsuite='autopkgtest')
# #
# # self.run_it(
# # [('lightgreen', {'Version': '2'}, 'autopkgtest')],
# # {'lightgreen': (False, {'lightgreen': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING'},
# # 'rainbow': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
# # }),
# # },
# # {'lightgreen': [('old-version', '1'), ('new-version', '2')]}
# # )
def test_nbs(self):
'''source-less binaries do not cause harm'''
@ -1920,29 +1921,27 @@ class T(TestBase):
{'lightgreen': [('reason', 'block')]}
)
################################################################
# Tests for non-hint policies (Ubuntu only)
################################################################
### def test_lp_bug_block(self):
### self.data.add_default_packages(darkgreen=False)
###
### with open(os.path.join(self.data.path, 'data/unstable/Blocks'), 'w') as f:
### f.write('darkgreen 12345 1471505000\ndarkgreen 98765 1471500000\n')
###
### exc = self.run_it(
### [('darkgreen', {'Version': '2'}, 'autopkgtest')],
### {'darkgreen': (False, {'darkgreen': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}})},
### {'darkgreen': [('reason', 'block'),
### ('excuses', 'Not touching package as requested in <a href="https://launchpad.net/bugs/12345">bug 12345</a> on Thu Aug 18 07:23:20 2016'),
### ('is-candidate', False),
### ]
### }
### )[1]
### self.assertEqual(exc['darkgreen']['policy_info']['block-bugs'],
### {'12345': 1471505000, '98765': 1471500000})
# # def test_lp_bug_block(self):
# # self.data.add_default_packages(darkgreen=False)
# #
# # with open(os.path.join(self.data.path, 'data/unstable/Blocks'), 'w') as f:
# # f.write('darkgreen 12345 1471505000\ndarkgreen 98765 1471500000\n')
# #
# # exc = self.run_it(
# # [('darkgreen', {'Version': '2'}, 'autopkgtest')],
# # {'darkgreen': (False, {'darkgreen': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}})},
# # {'darkgreen': [('reason', 'block'),
# # ('excuses', 'Not touching package as requested in <a href="https://launchpad.net/bugs/12345">bug 12345</a> on Thu Aug 18 07:23:20 2016'),
# # ('is-candidate', False),
# # ]
# # }
# # )[1]
# # self.assertEqual(exc['darkgreen']['policy_info']['block-bugs'],
# # {'12345': 1471505000, '98765': 1471500000})
################################################################
# Kernel related tests
@ -2056,100 +2055,100 @@ class T(TestBase):
self.assertEqual(self.pending_requests,
{'linux-meta-lts-grumpy/1': {'fancy': ['amd64']}})
### def test_kernel_triggered_tests(self):
### '''linux, lxc, glibc, systemd, snapd tests get triggered by linux-meta* uploads'''
###
### self.data.add('libc6-dev', False, {'Source': 'glibc', 'Depends': 'linux-libc-dev'},
### testsuite='autopkgtest')
### self.data.add('libc6-dev', True, {'Source': 'glibc', 'Depends': 'linux-libc-dev'},
### testsuite='autopkgtest')
### self.data.add('lxc', False, {}, testsuite='autopkgtest')
### self.data.add('lxc', True, {}, testsuite='autopkgtest')
### self.data.add('systemd', False, {}, testsuite='autopkgtest')
### self.data.add('systemd', True, {}, testsuite='autopkgtest')
### self.data.add('snapd', False, {}, testsuite='autopkgtest')
### self.data.add('snapd', True, {}, testsuite='autopkgtest')
### self.data.add('linux-image-1', False, {'Source': 'linux'}, testsuite='autopkgtest')
### self.data.add('linux-image-1', True, {'Source': 'linux'}, testsuite='autopkgtest')
### self.data.add('linux-libc-dev', False, {'Source': 'linux'}, testsuite='autopkgtest')
### self.data.add('linux-image', False, {'Source': 'linux-meta', 'Depends': 'linux-image-1'})
###
### self.swift.set_results({'autopkgtest-testing': {
### 'testing/amd64/l/lxc/20150101_100101@': (0, 'lxc 0.1', tr('passedbefore/1'))
### }})
###
### exc = self.run_it(
### [('linux-image', {'Version': '2', 'Depends': 'linux-image-2', 'Source': 'linux-meta'}, None),
### ('linux-image-64only', {'Source': 'linux-meta-64only', 'Architecture': 'amd64'}, None),
### ('linux-image-2', {'Version': '2', 'Source': 'linux'}, 'autopkgtest'),
### ('linux-libc-dev', {'Version': '2', 'Source': 'linux'}, 'autopkgtest'),
### ],
### {'linux-meta': (False, {'lxc': {'amd64': 'RUNNING', 'i386': 'RUNNING-ALWAYSFAIL'},
### 'glibc': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
### 'linux': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
### 'systemd': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
### 'snapd': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
### }),
### 'linux-meta-64only': (False, {'lxc': {'amd64': 'RUNNING'}}),
### 'linux': (False, {}),
### })[1]
### # the kernel itself should not trigger tests; we want to trigger
### # everything from -meta
### self.assertEqual(exc['linux']['policy_info']['autopkgtest'], {})
### def test_kernel_waits_on_meta(self):
### '''linux waits on linux-meta'''
###
### self.data.add('dkms', False, {})
### self.data.add('dkms', True, {})
### self.data.add('fancy-dkms', False, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'})
### self.data.add('fancy-dkms', True, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'})
### self.data.add('linux-image-generic', False, {'Version': '0.1', 'Source': 'linux-meta', 'Depends': 'linux-image-1'})
### self.data.add('linux-image-1', False, {'Source': 'linux'}, testsuite='autopkgtest')
### self.data.add('linux-firmware', False, {'Source': 'linux-firmware'}, testsuite='autopkgtest')
###
### self.swift.set_results({'autopkgtest-testing': {
### 'testing/i386/f/fancy/20150101_090000@': (0, 'fancy 0.5', tr('passedbefore/1')),
### 'testing/i386/l/linux/20150101_100000@': (0, 'linux 2', tr('linux-meta/0.2')),
### 'testing/amd64/l/linux/20150101_100000@': (0, 'linux 2', tr('linux-meta/0.2')),
### 'testing/i386/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', tr('linux-firmware/2')),
### 'testing/amd64/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', tr('linux-firmware/2')),
### }})
###
### self.run_it(
### [('linux-image-generic', {'Version': '0.2', 'Source': 'linux-meta', 'Depends': 'linux-image-2'}, None),
### ('linux-image-2', {'Version': '2', 'Source': 'linux'}, 'autopkgtest'),
### ('linux-firmware', {'Version': '2', 'Source': 'linux-firmware'}, 'autopkgtest'),
### ],
### {'linux-meta': (False, {'fancy': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING'},
### 'linux/2': {'amd64': 'PASS', 'i386': 'PASS'}
### }),
### # no tests, but should wait on linux-meta
### 'linux': (False, {}),
### # this one does not have a -meta, so don't wait
### 'linux-firmware': (True, {'linux-firmware/2': {'amd64': 'PASS', 'i386': 'PASS'}}),
### },
### {'linux': [('reason', 'depends'),
### ('excuses', 'Invalidated by dependency'),
### ('dependencies', {'blocked-by': ['linux-meta']})]
### }
### )
###
### # now linux-meta is ready to go
### self.swift.set_results({'autopkgtest-testing': {
### 'testing/i386/f/fancy/20150101_100000@': (0, 'fancy 1', tr('linux-meta/0.2')),
### 'testing/amd64/f/fancy/20150101_100000@': (0, 'fancy 1', tr('linux-meta/0.2')),
### }})
### self.run_it(
### [],
### {'linux-meta': (True, {'fancy/1': {'amd64': 'PASS', 'i386': 'PASS'},
### 'linux/2': {'amd64': 'PASS', 'i386': 'PASS'}}),
### 'linux': (True, {}),
### 'linux-firmware': (True, {'linux-firmware/2': {'amd64': 'PASS', 'i386': 'PASS'}}),
### },
### {'linux': [('dependencies', {'migrate-after': ['linux-meta']})]
### }
### )
# # def test_kernel_triggered_tests(self):
# # '''linux, lxc, glibc, systemd, snapd tests get triggered by linux-meta* uploads'''
# #
# # self.data.add('libc6-dev', False, {'Source': 'glibc', 'Depends': 'linux-libc-dev'},
# # testsuite='autopkgtest')
# # self.data.add('libc6-dev', True, {'Source': 'glibc', 'Depends': 'linux-libc-dev'},
# # testsuite='autopkgtest')
# # self.data.add('lxc', False, {}, testsuite='autopkgtest')
# # self.data.add('lxc', True, {}, testsuite='autopkgtest')
# # self.data.add('systemd', False, {}, testsuite='autopkgtest')
# # self.data.add('systemd', True, {}, testsuite='autopkgtest')
# # self.data.add('snapd', False, {}, testsuite='autopkgtest')
# # self.data.add('snapd', True, {}, testsuite='autopkgtest')
# # self.data.add('linux-image-1', False, {'Source': 'linux'}, testsuite='autopkgtest')
# # self.data.add('linux-image-1', True, {'Source': 'linux'}, testsuite='autopkgtest')
# # self.data.add('linux-libc-dev', False, {'Source': 'linux'}, testsuite='autopkgtest')
# # self.data.add('linux-image', False, {'Source': 'linux-meta', 'Depends': 'linux-image-1'})
# #
# # self.swift.set_results({'autopkgtest-testing': {
# # 'testing/amd64/l/lxc/20150101_100101@': (0, 'lxc 0.1', tr('passedbefore/1'))
# # }})
# #
# # exc = self.run_it(
# # [('linux-image', {'Version': '2', 'Depends': 'linux-image-2', 'Source': 'linux-meta'}, None),
# # ('linux-image-64only', {'Source': 'linux-meta-64only', 'Architecture': 'amd64'}, None),
# # ('linux-image-2', {'Version': '2', 'Source': 'linux'}, 'autopkgtest'),
# # ('linux-libc-dev', {'Version': '2', 'Source': 'linux'}, 'autopkgtest'),
# # ],
# # {'linux-meta': (False, {'lxc': {'amd64': 'RUNNING', 'i386': 'RUNNING-ALWAYSFAIL'},
# # 'glibc': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
# # 'linux': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
# # 'systemd': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
# # 'snapd': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
# # }),
# # 'linux-meta-64only': (False, {'lxc': {'amd64': 'RUNNING'}}),
# # 'linux': (False, {}),
# # })[1]
# # # the kernel itself should not trigger tests; we want to trigger
# # # everything from -meta
# # self.assertEqual(exc['linux']['policy_info']['autopkgtest'], {})
# # def test_kernel_waits_on_meta(self):
# # '''linux waits on linux-meta'''
# #
# # self.data.add('dkms', False, {})
# # self.data.add('dkms', True, {})
# # self.data.add('fancy-dkms', False, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'})
# # self.data.add('fancy-dkms', True, {'Source': 'fancy', 'Depends': 'dkms (>= 1)'})
# # self.data.add('linux-image-generic', False, {'Version': '0.1', 'Source': 'linux-meta', 'Depends': 'linux-image-1'})
# # self.data.add('linux-image-1', False, {'Source': 'linux'}, testsuite='autopkgtest')
# # self.data.add('linux-firmware', False, {'Source': 'linux-firmware'}, testsuite='autopkgtest')
# #
# # self.swift.set_results({'autopkgtest-testing': {
# # 'testing/i386/f/fancy/20150101_090000@': (0, 'fancy 0.5', tr('passedbefore/1')),
# # 'testing/i386/l/linux/20150101_100000@': (0, 'linux 2', tr('linux-meta/0.2')),
# # 'testing/amd64/l/linux/20150101_100000@': (0, 'linux 2', tr('linux-meta/0.2')),
# # 'testing/i386/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', tr('linux-firmware/2')),
# # 'testing/amd64/l/linux-firmware/20150101_100000@': (0, 'linux-firmware 2', tr('linux-firmware/2')),
# # }})
# #
# # self.run_it(
# # [('linux-image-generic', {'Version': '0.2', 'Source': 'linux-meta', 'Depends': 'linux-image-2'}, None),
# # ('linux-image-2', {'Version': '2', 'Source': 'linux'}, 'autopkgtest'),
# # ('linux-firmware', {'Version': '2', 'Source': 'linux-firmware'}, 'autopkgtest'),
# # ],
# # {'linux-meta': (False, {'fancy': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING'},
# # 'linux/2': {'amd64': 'PASS', 'i386': 'PASS'}
# # }),
# # # no tests, but should wait on linux-meta
# # 'linux': (False, {}),
# # # this one does not have a -meta, so don't wait
# # 'linux-firmware': (True, {'linux-firmware/2': {'amd64': 'PASS', 'i386': 'PASS'}}),
# # },
# # {'linux': [('reason', 'depends'),
# # ('excuses', 'Invalidated by dependency'),
# # ('dependencies', {'blocked-by': ['linux-meta']})]
# # }
# # )
# #
# # # now linux-meta is ready to go
# # self.swift.set_results({'autopkgtest-testing': {
# # 'testing/i386/f/fancy/20150101_100000@': (0, 'fancy 1', tr('linux-meta/0.2')),
# # 'testing/amd64/f/fancy/20150101_100000@': (0, 'fancy 1', tr('linux-meta/0.2')),
# # }})
# # self.run_it(
# # [],
# # {'linux-meta': (True, {'fancy/1': {'amd64': 'PASS', 'i386': 'PASS'},
# # 'linux/2': {'amd64': 'PASS', 'i386': 'PASS'}}),
# # 'linux': (True, {}),
# # 'linux-firmware': (True, {'linux-firmware/2': {'amd64': 'PASS', 'i386': 'PASS'}}),
# # },
# # {'linux': [('dependencies', {'migrate-after': ['linux-meta']})]
# # }
# # )
################################################################
# Tests for special-cased packages
@ -2256,8 +2255,11 @@ class T(TestBase):
'verdict': 'PASS'})
for arch in ['i386', 'amd64']:
self.assertTrue('debci-ppa-testing-%s:lightgreen {"triggers": ["lightgreen/2"], "ppas": ["joe/foo", "awesome-developers/staging"]}' % arch in self.amqp_requests or
'debci-ppa-testing-%s:lightgreen {"ppas": ["joe/foo", "awesome-developers/staging"], "triggers": ["lightgreen/2"]}' % arch in self.amqp_requests,
self.assertTrue(
('debci-ppa-testing-%s:lightgreen {"triggers": ["lightgreen/2"], '
'"ppas": ["joe/foo", "awesome-developers/staging"]}') % arch in self.amqp_requests or
('debci-ppa-testing-%s:lightgreen {"ppas": ["joe/foo", '
'"awesome-developers/staging"], "triggers": ["lightgreen/2"]}') % arch in self.amqp_requests,
self.amqp_requests)
self.assertEqual(len(self.amqp_requests), 2)
@ -2273,17 +2275,24 @@ class T(TestBase):
{'lightgreen': (False, {'lightgreen/2': {'i386': 'REGRESSION', 'amd64': 'PASS'}})},
{'lightgreen': [('old-version', '1'), ('new-version', '2')]}
)[1]
self.assertEqual(exc['lightgreen']['policy_info']['autopkgtest'],
self.assertEqual(
exc['lightgreen']['policy_info']['autopkgtest'],
{'lightgreen/2': {
'amd64': ['PASS',
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/testing/amd64/l/lightgreen/20150101_100101@/log.gz',
'amd64': [
'PASS',
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/'
'testing/amd64/l/lightgreen/20150101_100101@/log.gz',
None,
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/testing/amd64/l/lightgreen/20150101_100101@/artifacts.tar.gz',
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/'
'testing/amd64/l/lightgreen/20150101_100101@/artifacts.tar.gz',
None],
'i386': ['REGRESSION',
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/testing/i386/l/lightgreen/20150101_100100@/log.gz',
'i386': [
'REGRESSION',
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/'
'testing/i386/l/lightgreen/20150101_100100@/log.gz',
None,
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/testing/i386/l/lightgreen/20150101_100100@/artifacts.tar.gz',
'http://localhost:18085/autopkgtest-testing-awesome-developers-staging/'
'testing/i386/l/lightgreen/20150101_100100@/artifacts.tar.gz',
'https://autopkgtest.ubuntu.com/request.cgi?release=testing&arch=i386&package=lightgreen&'
'trigger=lightgreen%2F2&ppa=joe%2Ffoo&ppa=awesome-developers%2Fstaging']},
'verdict': 'REJECTED_PERMANENTLY'})
@ -2308,10 +2317,10 @@ class T(TestBase):
self.assertFalse(os.path.exists(os.path.join(self.data.path, 'output', 'output.txt')))
self.assertNotEqual(self.amqp_requests, set())
# must still record pending tests
#### Not sure why this doesn't work in the debian env.
### self.assertEqual(self.pending_requests, {'green/2': {'green': ['amd64', 'i386'],
### 'darkgreen': ['amd64', 'i386'],
### 'lightgreen': ['amd64', 'i386']}})
# ## Not sure why this doesn't work in the debian env.
# # self.assertEqual(self.pending_requests, {'green/2': {'green': ['amd64', 'i386'],
# # 'darkgreen': ['amd64', 'i386'],
# # 'lightgreen': ['amd64', 'i386']}})
def test_shared_results_cache(self):
'''Run with shared r/o autopkgtest-results.cache'''
@ -2364,58 +2373,57 @@ class T(TestBase):
# Tests for source ppa grouping
################################################################
### def test_sourceppa_policy(self):
### '''Packages from same source PPA get rejected for failed peer policy'''
###
### self.data.add_default_packages(green=False)
###
### ppa = 'devel/~ci-train-ppa-service/+archive/NNNN'
### self.sourceppa_cache['green'] = {'2': ppa}
### self.sourceppa_cache['red'] = {'2': ppa}
### with open(os.path.join(self.data.path, 'data/unstable/Blocks'), 'w') as f:
### f.write('green 12345 1471505000\ndarkgreen 98765 1471500000\n')
###
### exc = self.run_it(
### [('green', {'Version': '2'}, 'autopkgtest'),
### ('red', {'Version': '2'}, 'autopkgtest'),
### ('gcc-5', {}, 'autopkgtest')],
### {'green': (False, {'green': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}}),
### 'red': (False, {'red': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}}),
### 'gcc-5': (True, {}),
### },
### {'green': [('reason', 'block')],
### 'red': [('reason', 'source-ppa')]}
### )[1]
### self.assertEqual(exc['red']['policy_info']['source-ppa'], {'red': ppa, 'green': ppa})
###
### with open(os.path.join(self.data.path, 'data/unstable/SourcePPA')) as f:
### res = json.load(f)
### self.assertEqual(res, {'red': {'2': ppa},
### 'green': {'2': ppa},
### 'gcc-5': {'1': ''}})
### def test_sourceppa_missingbuild(self):
### '''Packages from same source PPA get rejected for failed peer FTBFS'''
###
### self.data.add_default_packages(green=False)
###
### ppa = 'devel/~ci-train-ppa-service/+archive/ZZZZ'
### self.sourceppa_cache['green'] = {'2': ppa}
### self.sourceppa_cache['red'] = {'2': ppa}
###
### self.data.add_src('green', True, {'Version': '2', 'Testsuite': 'autopkgtest'})
### self.data.add('libgreen1', True, {'Version': '2', 'Source': 'green', 'Architecture': 'i386'}, add_src=False)
### self.data.add('green', True, {'Version': '2', 'Source': 'green'}, add_src=False)
###
### exc = self.run_it(
### [('red', {'Version': '2'}, 'autopkgtest')],
### {'green': (False, {}), 'red': (False, {})},
### {'green': [('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'],
### 'on-unimportant-architectures': []})],
### 'red': [('reason', 'source-ppa')]}
### )[1]
### self.assertEqual(exc['red']['policy_info']['source-ppa'], {'red': ppa, 'green': ppa})
# # def test_sourceppa_policy(self):
# # '''Packages from same source PPA get rejected for failed peer policy'''
# #
# # self.data.add_default_packages(green=False)
# #
# # ppa = 'devel/~ci-train-ppa-service/+archive/NNNN'
# # self.sourceppa_cache['green'] = {'2': ppa}
# # self.sourceppa_cache['red'] = {'2': ppa}
# # with open(os.path.join(self.data.path, 'data/unstable/Blocks'), 'w') as f:
# # f.write('green 12345 1471505000\ndarkgreen 98765 1471500000\n')
# #
# # exc = self.run_it(
# # [('green', {'Version': '2'}, 'autopkgtest'),
# # ('red', {'Version': '2'}, 'autopkgtest'),
# # ('gcc-5', {}, 'autopkgtest')],
# # {'green': (False, {'green': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}}),
# # 'red': (False, {'red': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}}),
# # 'gcc-5': (True, {}),
# # },
# # {'green': [('reason', 'block')],
# # 'red': [('reason', 'source-ppa')]}
# # )[1]
# # self.assertEqual(exc['red']['policy_info']['source-ppa'], {'red': ppa, 'green': ppa})
# #
# # with open(os.path.join(self.data.path, 'data/unstable/SourcePPA')) as f:
# # res = json.load(f)
# # self.assertEqual(res, {'red': {'2': ppa},
# # 'green': {'2': ppa},
# # 'gcc-5': {'1': ''}})
# # def test_sourceppa_missingbuild(self):
# # '''Packages from same source PPA get rejected for failed peer FTBFS'''
# #
# # self.data.add_default_packages(green=False)
# #
# # ppa = 'devel/~ci-train-ppa-service/+archive/ZZZZ'
# # self.sourceppa_cache['green'] = {'2': ppa}
# # self.sourceppa_cache['red'] = {'2': ppa}
# #
# # self.data.add_src('green', True, {'Version': '2', 'Testsuite': 'autopkgtest'})
# # self.data.add('libgreen1', True, {'Version': '2', 'Source': 'green', 'Architecture': 'i386'}, add_src=False)
# # self.data.add('green', True, {'Version': '2', 'Source': 'green'}, add_src=False)
# #
# # exc = self.run_it(
# # [('red', {'Version': '2'}, 'autopkgtest')],
# # {'green': (False, {}), 'red': (False, {})},
# # {'green': [('missing-builds', {'on-architectures': ['amd64', 'arm64', 'armhf', 'powerpc', 'ppc64el'],
# # 'on-unimportant-architectures': []})],
# # 'red': [('reason', 'source-ppa')]}
# # )[1]
# # self.assertEqual(exc['red']['policy_info']['source-ppa'], {'red': ppa, 'green': ppa})
def test_swift_url_is_file(self):
'''Run without swift but with debci file (as Debian does)'''
@ -2436,15 +2444,24 @@ class T(TestBase):
{
"until": 12345,
"results": [
{"trigger": "green/2", "package": "darkgreen", "arch": "i386", "version": "1", "status": "pass", "run_id": "100000", "updated_at": "2018-10-04T11:18:00.000Z"},
{"trigger": "green/2", "package": "darkgreen", "arch": "amd64", "version": "1", "status": "pass", "run_id": "100000", "updated_at": "2018-10-04T11:18:01.000Z"},
{"trigger": "green/1", "package": "lightgreen", "arch": "i386", "version": "1", "status": "pass", "run_id": "101000", "updated_at": "2018-10-04T11:18:02.000Z"},
{"trigger": "green/2", "package": "lightgreen", "arch": "i386", "version": "1", "status": "fail", "run_id": "101001", "updated_at": "2018-10-04T11:18:03.000Z"},
{"trigger": "green/1", "package": "lightgreen", "arch": "amd64", "version": "1", "status": "pass", "run_id": "101000", "updated_at": "2018-10-04T11:18:04.000Z"},
{"trigger": "green/2", "package": "lightgreen", "arch": "amd64", "version": "1", "status": "fail", "run_id": "101001", "updated_at": "2018-10-04T11:18:05.000Z"},
{"trigger": "green/2", "package": "green", "arch": "i386", "version": "2", "status": "pass", "run_id": "102000", "updated_at": "2018-10-04T11:18:06.000Z"},
{"trigger": "green/1", "package": "green", "arch": "amd64", "version": "2", "status": "pass", "run_id": "102000", "updated_at": "2018-10-04T11:18:07.000Z"},
{"trigger": "green/2", "package": "green", "arch": "amd64", "version": "2", "status": "fail", "run_id": "102001", "updated_at": "2018-10-04T11:18:08.000Z"}
{"trigger": "green/2", "package": "darkgreen", "arch": "i386", "version": "1", "status": "pass",
"run_id": "100000", "updated_at": "2018-10-04T11:18:00.000Z"},
{"trigger": "green/2", "package": "darkgreen", "arch": "amd64", "version": "1", "status": "pass",
"run_id": "100000", "updated_at": "2018-10-04T11:18:01.000Z"},
{"trigger": "green/1", "package": "lightgreen", "arch": "i386", "version": "1", "status": "pass",
"run_id": "101000", "updated_at": "2018-10-04T11:18:02.000Z"},
{"trigger": "green/2", "package": "lightgreen", "arch": "i386", "version": "1", "status": "fail",
"run_id": "101001", "updated_at": "2018-10-04T11:18:03.000Z"},
{"trigger": "green/1", "package": "lightgreen", "arch": "amd64", "version": "1", "status": "pass",
"run_id": "101000", "updated_at": "2018-10-04T11:18:04.000Z"},
{"trigger": "green/2", "package": "lightgreen", "arch": "amd64", "version": "1", "status": "fail",
"run_id": "101001", "updated_at": "2018-10-04T11:18:05.000Z"},
{"trigger": "green/2", "package": "green", "arch": "i386", "version": "2", "status": "pass",
"run_id": "102000", "updated_at": "2018-10-04T11:18:06.000Z"},
{"trigger": "green/1", "package": "green", "arch": "amd64", "version": "2", "status": "pass",
"run_id": "102000", "updated_at": "2018-10-04T11:18:07.000Z"},
{"trigger": "green/2", "package": "green", "arch": "amd64", "version": "2", "status": "fail",
"run_id": "102001", "updated_at": "2018-10-04T11:18:08.000Z"}
]
}
''')

@ -20,7 +20,7 @@ EXCEPTIONS_BY_FILE = {
'britney2/policies/autopkgtest.py': 0,
'tests/mock_swift.py': 2,
'tests/__init__.py': 31,
'tests/test_autopkgtest.py': 338,
'tests/test_autopkgtest.py': 2,
'tests/test_policy.py': 31,
'tests/test_yaml.py': 1,
}

Loading…
Cancel
Save