Skip to content
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

Added Test Publisher #464

Closed
wants to merge 11 commits into from

Conversation

owaiskazi19
Copy link
Member

Signed-off-by: Owais Kazi [email protected]

Description

Implemented Test Publisher to store result of the test to S3.
Test Publisher will be invoked by Test Recorder. Part of #340

Issues Resolved

Closes #341

Check List

  • Commits are signed per the DCO using --signoff

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.

Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../src"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any better way to do this? Require this to import aws module below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be required at all when run from the test.sh driver because it introduces a stable path. That's why we have those things.

Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../src"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be required at all when run from the test.sh driver because it introduces a stable path. That's why we have those things.

from aws.s3_bucket import S3Bucket


class TestPublisher:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest renaming this to TestResults, since it wraps test results, and rename publish_test_results_to_s3 to to_s3, similar to other to_file or to_dict that we have on other classes.

I would add TestRecorder.results that returns an instance of test results.

Remove s3_bucket from the constructor since it never consumes S3 results, and make it a parameter in to_s3, so TestResults().to_s3(bucket).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change the name in the proposal as well #207 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestPublisher feels right to me as this class really just publishes the results while wrapping them up in the right directory structure. But I would leave it to dB who is our master of renaming :).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dblock any thoughts on this?

Copy link
Member

@dblock dblock Sep 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong feelings. You're choosing between a verb and a noun. In OO I prefer nouns.

Signed-off-by: Owais Kazi <[email protected]>
from test_workflow.test_results import TestResults


class TestTestResults(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chuckled at this!

from aws.s3_bucket import S3Bucket


class TestPublisher:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestPublisher feels right to me as this class really just publishes the results while wrapping them up in the right directory structure. But I would leave it to dB who is our master of renaming :).

Publishes tests results to S3 pulling information from {self.test_recorder}
And cleans up all local storage after publishing ({self.test_recorder}.clean_up())
"""
s3_bucket = S3Bucket(bucket, '<role-arn>', 'test-publisher-session')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already have a role defined. @gaiksaya could help and chime in with the role we have already created in Jenkins?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Asked @owaiskazi19 to remove this params except the s3bucket. They are not required.

Copy link
Member

@saratvemulapalli saratvemulapalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the change look good.

def to_s3(self, bucket):
"""
Publishes tests results to S3 pulling information from {self.test_recorder}
And cleans up all local storage after publishing ({self.test_recorder}.clean_up())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix this comment as TestRecorder cleans it up by itself and TestPublisher doesn't have to be worried about it.

Copy link
Member

@gaiksaya gaiksaya Sep 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestRecorder is not cleaning up. I removed the clean_up block but it is creating the temporary directory (when the user doesnot provide the location specifically) which I assume will be cleaned up eventually by the system?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Responded on the other PR so that its clear: https://github.com/opensearch-project/opensearch-build/pull/467/files#r708746645
I'll update the comment on #207

@owaiskazi19
Copy link
Member Author

Can open this PR once #467 gets merged.

self.bundle_manifest = bundle_manifest
self.test_recorder = test_recorder

def to_s3(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need a to_local method to publish logs locally for devs

@dblock
Copy link
Member

dblock commented Sep 28, 2021

#467 was merged, what's next for this?

@owaiskazi19
Copy link
Member Author

owaiskazi19 commented Sep 28, 2021

#467 was merged, what's next for this?

#467 was closed and not merged. #587 is open.

@peternied
Copy link
Member

@owaiskazi19 it looks like #587 has been merged, did you want to pick this back up?

@owaiskazi19
Copy link
Member Author

@owaiskazi19 it looks like #587 has been merged, did you want to pick this back up?

Hey @peternied! As discussed, @gaiksaya will be working on the remaining chunks of TestPublisher. #341.

@dblock
Copy link
Member

dblock commented Oct 11, 2021

Let's close this until @gaiksaya re-raises a working PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestPublisher: Implement result publisher
6 participants