-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
Add unit test to spark_ec2 script #134
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
*.ipr | ||
*.iml | ||
*.iws | ||
*.pyc | ||
.idea/ | ||
sbt/*.jar | ||
.settings | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import unittest | ||
|
||
from boto import ec2 | ||
import mock | ||
import moto | ||
|
||
import spark_ec2 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra newline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extra newline before classes is required by the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I check code in pyspark as well and we do follow the flake8 defaults of extra newline before classes. So keep this in is absolutely fine. |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add some class level comments and instructions on how to run this test here ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
class CommandTests(unittest.TestCase): | ||
|
||
@moto.mock_ec2 | ||
def test_destroy(self): | ||
spark_ec2.AWS_EVENTUAL_CONSISTENCY = 1 | ||
opts = mock.MagicMock(name='opts') | ||
opts.region = "us-east-1" | ||
conn = ec2.connect_to_region(opts.region) | ||
cluster_name = "cluster_name" | ||
try: | ||
spark_ec2.destroy_cluster(conn, opts, cluster_name) | ||
except: | ||
self.fail("destroy_cluster raised unexpected exception") | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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.
This should probably include
and definitely include the Apache license header
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.
Done