-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require test manifest path for running tests #1229
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1229 +/- ##
============================================
+ Coverage 93.26% 94.06% +0.80%
Complexity 11 11
============================================
Files 116 120 +4
Lines 2761 2799 +38
Branches 10 10
============================================
+ Hits 2575 2633 +58
+ Misses 176 156 -20
Partials 10 10
Continue to review full report at Codecov.
|
Introduced an attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I don't think I understand what purposeOh I see, CI is failing on these manifests because it doesn't know that it's a test manifest. For now I'd rather not add a type (we should then be adding types to all manifests, which seems like an overkill), but just hard-code skipping files that are calledtype
serves when it can only be "test"? What other type will be there? When does it need to be distinguished from an input manifest?*-test.yml
. -
It seems like all test workflows require the test manifest. If that's the case it should be a required positional parameter, e.g.
./test.sh [kind of test] [test manifest] [build location]
to be consistent with the other runners.
For 1, sure. I can switch to a simple file name check. For 2. This is already achieved by this PR. If not specified, this will fail |
As a side effect - you get an error that the path specified doesn't exist or not a URL vs. you forgot to specify it. Make it required in test args. Then I would really change --arg to a positional operator, because it's always required to be consistent with all other runners. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're almost there!
Look at what's common between CiInputManifest
and CiTestManifest
: they both create an instance of a Manifest by calling .from_file
on it and both take args
. Add that into CiManifest
constructor.
class CiManifest:
def __init__(self, manifest, args):
self.manifest = manifest
self.args = args
Your child class becomes:
class CiInputManifest(CiManifest):
def __init__(self, filename, args):
super().__init__(self, InputManifest.from_file(filename), args)
The check
method is on both classes and should be implemented on CiManifest
for all the common parts. The pattern is to have a check
method on the base class and an abstract __check__
method overridden in both child classes.
def check(self):
try:
self.__check__()
except:
...
raise
Finally, __is_test_manifest
is glaring "not object oriented", but now that your CiManifest
takes the same arguments it becomes easier, add a CiManifests
class.
class CiManifests:
def __klass(filename):
if re.search(...):
return CiTestManifest
else:
return CiInputManifest
def from_file(filename, args):
return self.__klass(filename)(filename, args)
jenkins/test/testsuite/Jenkinsfile
Outdated
@@ -60,7 +60,7 @@ pipeline { | |||
script { | |||
basePath = "https://ci.opensearch.org/ci/dbc/bundle-build/${opensearch_version}/${build_id}/${platform}/${architecture}" | |||
sh "wget ${basePath}/builds/opensearch/manifest.yml" | |||
sh "./test.sh ${JOB_NAME} ${basePath} --test-run-id ${env.BUILD_NUMBER}" | |||
sh "./test.sh ${JOB_NAME} manifests/${opensearch_version}/opensearch-${opensearch_version}-test.yml ${basePath} --test-run-id ${env.BUILD_NUMBER}" | |||
} | |||
} | |||
post() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For later: we should probably move this file under opensearch/
since we'll need one of these for Dashboards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dashboards will have a test manifest with "opensearch-dashboards". Thus sub dir is no needed due to different names.
Thanks for the detailed instructions! The code now looks super elegant |
Noticed "This branch has conflicts that must be resolved". Taking a look |
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
Signed-off-by: Tianle Huang <tianleh@amazon.com>
cf8ab75
to
dd26c3e
Compare
Resolved merge conflict. Please help review. @dblock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and clean!
Signed-off-by: Tianle Huang tianleh@amazon.com
Description
Move test manifest to the
manifests
dir and require--test-manifest-path
. This will address parts of @dblock 's comments on #1222Issues Resolved
Resolves #1228
Test
local tests
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.