mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-04 02:24:24 +00:00 
			
		
		
		
	Cosmetic changes for adding excuse labels (html) and more readable image manifest path.
This commit is contained in:
		
							parent
							
								
									a84720951a
								
							
						
					
					
						commit
						ed31f1129b
					
				
							
								
								
									
										14
									
								
								boottest.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								boottest.py
									
									
									
									
									
								
							@ -24,7 +24,7 @@ class TouchManifest(object):
 | 
			
		||||
    Assumes the deployment is arranged in a way the manifest is available
 | 
			
		||||
    and fresh on:
 | 
			
		||||
 | 
			
		||||
    'data/boottest/{distribution}/{series}/manifest'
 | 
			
		||||
    '{britney_cwd}/boottest/images/{distribution}/{series}/manifest'
 | 
			
		||||
 | 
			
		||||
    Only binary name matters, version is ignored, so callsites can:
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ class TouchManifest(object):
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def __init__(self, distribution, series):
 | 
			
		||||
        self.path = 'data/boottest/{}/{}/manifest'.format(
 | 
			
		||||
        self.path = 'boottest/images/{}/{}/manifest'.format(
 | 
			
		||||
            distribution, series)
 | 
			
		||||
        self._manifest = self._load()
 | 
			
		||||
 | 
			
		||||
@ -66,6 +66,14 @@ class BootTest(object):
 | 
			
		||||
 | 
			
		||||
    TBD!
 | 
			
		||||
    """
 | 
			
		||||
    VALID_STATUSES = ('PASS', 'SKIPPED')
 | 
			
		||||
 | 
			
		||||
    EXCUSE_LABELS = {
 | 
			
		||||
        "PASS": '<span style="background:#87d96c">Pass</span>',
 | 
			
		||||
        "SKIPPED": '<span style="background:#e5c545">Skipped</span>',
 | 
			
		||||
        "FAIL": '<span style="background:#ff6666">Regression</span>',
 | 
			
		||||
        "RUNNING": '<span style="background:#99ddff">Test in progress</span>',
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def __init__(self, britney, distribution, series, debug=False):
 | 
			
		||||
        self.britney = britney
 | 
			
		||||
@ -86,7 +94,7 @@ class BootTest(object):
 | 
			
		||||
                return 'PASS'
 | 
			
		||||
            return 'FAIL'
 | 
			
		||||
 | 
			
		||||
        return 'IN PROGRESS'
 | 
			
		||||
        return 'RUNNING'
 | 
			
		||||
 | 
			
		||||
    def update(self, excuse):
 | 
			
		||||
        """Update given 'excuse' and yields testing status.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								britney.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								britney.py
									
									
									
									
									
								
							@ -1897,17 +1897,19 @@ class Britney(object):
 | 
			
		||||
                # Skip already invalid excuses.
 | 
			
		||||
                if not excuse.is_valid:
 | 
			
		||||
                    continue
 | 
			
		||||
                labels = set()
 | 
			
		||||
                statuses = set()
 | 
			
		||||
                # Update valid excuses from the boottest context and if they
 | 
			
		||||
                # have failed, block their migration.
 | 
			
		||||
                for binary_name, label in boottest.update(excuse):
 | 
			
		||||
                for binary_name, status in boottest.update(excuse):
 | 
			
		||||
                    label = BootTest.EXCUSE_LABELS.get(
 | 
			
		||||
                        status, 'UNKNOWN STATUS')
 | 
			
		||||
                    excuse.addhtml("boottest for %s %s: %s" %
 | 
			
		||||
                                   (binary_name, excuse.ver[1], label))
 | 
			
		||||
                    labels.add(label)
 | 
			
		||||
                    statuses.add(status)
 | 
			
		||||
                # If all boottests passed or were skipped, the excuse is
 | 
			
		||||
                # clean and promotion can proceed, according to the
 | 
			
		||||
                # boottest criteria. Otherwise block the promotion.
 | 
			
		||||
                if not labels.issubset(set(['PASS', 'SKIPPED'])):
 | 
			
		||||
                if not statuses.issubset(set(BootTest.VALID_STATUSES)):
 | 
			
		||||
                    excuse.addhtml("Not considered")
 | 
			
		||||
                    excuse.addreason("boottest")
 | 
			
		||||
                    excuse.is_valid = False
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,10 @@ PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
			
		||||
sys.path.insert(0, PROJECT_DIR)
 | 
			
		||||
 | 
			
		||||
from tests import TestBase
 | 
			
		||||
from boottest import TouchManifest
 | 
			
		||||
from boottest import (
 | 
			
		||||
    BootTest,
 | 
			
		||||
    TouchManifest,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def create_manifest(manifest_dir, lines):
 | 
			
		||||
@ -33,8 +36,8 @@ class TestTouchManifest(unittest.TestCase):
 | 
			
		||||
        super(TestTouchManifest, self).setUp()
 | 
			
		||||
        self.path = tempfile.mkdtemp(prefix='boottest')
 | 
			
		||||
        os.chdir(self.path)
 | 
			
		||||
        self.datadir = os.path.join(self.path, 'data/boottest/')
 | 
			
		||||
        os.makedirs(self.datadir)
 | 
			
		||||
        self.imagesdir = os.path.join(self.path, 'boottest/images')
 | 
			
		||||
        os.makedirs(self.imagesdir)
 | 
			
		||||
        self.addCleanup(shutil.rmtree, self.path)
 | 
			
		||||
 | 
			
		||||
    def test_missing(self):
 | 
			
		||||
@ -45,7 +48,7 @@ class TestTouchManifest(unittest.TestCase):
 | 
			
		||||
 | 
			
		||||
    def test_simple(self):
 | 
			
		||||
        # Existing manifest file allows callsites to properly check presence.
 | 
			
		||||
        manifest_dir = os.path.join(self.datadir, 'ubuntu/vivid')
 | 
			
		||||
        manifest_dir = os.path.join(self.imagesdir, 'ubuntu/vivid')
 | 
			
		||||
        manifest_lines = [
 | 
			
		||||
            'bar 1234',
 | 
			
		||||
            'foo:armhf       1~beta1',
 | 
			
		||||
@ -91,7 +94,7 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        """Create a manifest for this britney run context."""
 | 
			
		||||
        path = os.path.join(
 | 
			
		||||
            self.data.path,
 | 
			
		||||
            'data/boottest/ubuntu/{}'.format(self.data.series))
 | 
			
		||||
            'boottest/images/ubuntu/{}'.format(self.data.series))
 | 
			
		||||
        create_manifest(path, lines)
 | 
			
		||||
 | 
			
		||||
    def do_test(self, context, expect=None, no_expect=None):
 | 
			
		||||
@ -121,8 +124,10 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            [r'\bgreen\b.*>1</a> to .*>1.1~beta<',
 | 
			
		||||
             '<li>boottest for green 1.1~beta: IN PROGRESS',
 | 
			
		||||
             '<li>boottest for libgreen1 1.1~beta: SKIPPED',
 | 
			
		||||
             '<li>boottest for green 1.1~beta: {}'.format(
 | 
			
		||||
                 BootTest.EXCUSE_LABELS['RUNNING']),
 | 
			
		||||
             '<li>boottest for libgreen1 1.1~beta: {}'.format(
 | 
			
		||||
                 BootTest.EXCUSE_LABELS['SKIPPED']),
 | 
			
		||||
             '<li>Not considered'])
 | 
			
		||||
 | 
			
		||||
    def test_pass(self):
 | 
			
		||||
@ -135,7 +140,8 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            [r'\bpyqt5-src\b.*\(- to .*>1.1~beta<',
 | 
			
		||||
             '<li>boottest for pyqt5 1.1~beta: PASS',
 | 
			
		||||
             '<li>boottest for pyqt5 1.1~beta: {}'.format(
 | 
			
		||||
                 BootTest.EXCUSE_LABELS['PASS']),
 | 
			
		||||
             '<li>Valid candidate'])
 | 
			
		||||
 | 
			
		||||
    def test_fail(self):
 | 
			
		||||
@ -148,7 +154,8 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            [r'\bpyqt5-src\b.*\(- to .*>1.1<',
 | 
			
		||||
             '<li>boottest for pyqt5 1.1: FAIL',
 | 
			
		||||
             '<li>boottest for pyqt5 1.1: {}'.format(
 | 
			
		||||
                 BootTest.EXCUSE_LABELS['FAIL']),
 | 
			
		||||
             '<li>Not considered'])
 | 
			
		||||
 | 
			
		||||
    def test_skipped(self):
 | 
			
		||||
@ -162,7 +169,8 @@ class TestBoottestEnd2End(TestBase):
 | 
			
		||||
        self.do_test(
 | 
			
		||||
            context,
 | 
			
		||||
            [r'\bapache2-src\b.*\(- to .*>2.4.8-1ubuntu1<',
 | 
			
		||||
             '<li>boottest for apache2 2.4.8-1ubuntu1: SKIPPED',
 | 
			
		||||
             '<li>boottest for apache2 2.4.8-1ubuntu1: {}'.format(
 | 
			
		||||
                 BootTest.EXCUSE_LABELS['SKIPPED']),
 | 
			
		||||
             '<li>Valid candidate'])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user