Add file exists check in integration-aliases test.

(cherry picked from commit 33a8be9109)
pull/45713/merge
Matt Clay 6 years ago committed by Toshio Kuratomi
parent 0183f2fc87
commit e295888117

@ -4,6 +4,7 @@ from __future__ import absolute_import, print_function
import json import json
import textwrap import textwrap
import re import re
import os
from lib.sanity import ( from lib.sanity import (
SanitySingleVersion, SanitySingleVersion,
@ -36,6 +37,8 @@ from lib.util import (
class IntegrationAliasesTest(SanitySingleVersion): class IntegrationAliasesTest(SanitySingleVersion):
"""Sanity test to evaluate integration test aliases.""" """Sanity test to evaluate integration test aliases."""
SHIPPABLE_YML = 'shippable.yml'
DISABLED = 'disabled/' DISABLED = 'disabled/'
UNSTABLE = 'unstable/' UNSTABLE = 'unstable/'
UNSUPPORTED = 'unsupported/' UNSUPPORTED = 'unsupported/'
@ -86,7 +89,7 @@ class IntegrationAliasesTest(SanitySingleVersion):
:rtype: list[str] :rtype: list[str]
""" """
if not self._shippable_yml_lines: if not self._shippable_yml_lines:
with open('shippable.yml', 'r') as shippable_yml_fd: with open(self.SHIPPABLE_YML, 'r') as shippable_yml_fd:
self._shippable_yml_lines = shippable_yml_fd.read().splitlines() self._shippable_yml_lines = shippable_yml_fd.read().splitlines()
return self._shippable_yml_lines return self._shippable_yml_lines
@ -143,6 +146,12 @@ class IntegrationAliasesTest(SanitySingleVersion):
if args.explain: if args.explain:
return SanitySuccess(self.name) return SanitySuccess(self.name)
if not os.path.isfile(self.SHIPPABLE_YML):
return SanityFailure(self.name, messages=[SanityMessage(
message='file missing',
path=self.SHIPPABLE_YML,
)])
results = dict( results = dict(
comments=[], comments=[],
labels={}, labels={},

Loading…
Cancel
Save