From d2268dcb37120114adb06824f360647e605aa66c Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Wed, 3 Oct 2018 15:01:50 -0700 Subject: [PATCH] Add file exists check in integration-aliases test. (cherry picked from commit 33a8be9109ff3bf77d21dfa0117238d0f081a0b1) --- test/runner/lib/sanity/integration_aliases.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/runner/lib/sanity/integration_aliases.py b/test/runner/lib/sanity/integration_aliases.py index f6913021d32..9ece2599e27 100644 --- a/test/runner/lib/sanity/integration_aliases.py +++ b/test/runner/lib/sanity/integration_aliases.py @@ -4,6 +4,7 @@ from __future__ import absolute_import, print_function import json import textwrap import re +import os from lib.sanity import ( SanitySingleVersion, @@ -36,6 +37,8 @@ from lib.util import ( class IntegrationAliasesTest(SanitySingleVersion): """Sanity test to evaluate integration test aliases.""" + SHIPPABLE_YML = 'shippable.yml' + DISABLED = 'disabled/' UNSTABLE = 'unstable/' UNSUPPORTED = 'unsupported/' @@ -86,7 +89,7 @@ class IntegrationAliasesTest(SanitySingleVersion): :rtype: list[str] """ 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() return self._shippable_yml_lines @@ -143,6 +146,12 @@ class IntegrationAliasesTest(SanitySingleVersion): if args.explain: 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( comments=[], labels={},