-
Notifications
You must be signed in to change notification settings - Fork 98
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 cases for quoted strings. #173
base: master
Are you sure you want to change the base?
Changes from 1 commit
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 |
---|---|---|
|
@@ -2,3 +2,8 @@ javascript/ | |
wsk | ||
scripts | ||
Godeps/_workspace | ||
.gradle/ | ||
.idea/ | ||
bin/ | ||
tests/build/ | ||
*.iml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ import common.Wsk | |
import common.WskProps | ||
import common.WskTestHelpers | ||
|
||
import scala.sys.process._ | ||
|
||
@RunWith(classOf[JUnitRunner]) | ||
class WskSdkTests extends TestHelpers with WskTestHelpers { | ||
|
||
|
@@ -82,6 +84,76 @@ class WskSdkTests extends TestHelpers with WskTestHelpers { | |
} | ||
} | ||
|
||
it should "download docker sdk when blackbox.tar.gz exists, and docker name should be quoted in error." in { | ||
val fileName = "blackbox.tar.gz" | ||
val dir = File.createTempFile("wskinstall", ".tmp") | ||
dir.delete() | ||
dir.mkdir() should be(true) | ||
val file = new File(dir, fileName) | ||
file.createNewFile should be (true) | ||
try { | ||
wsk.cli(wskprops.overrides ++ Seq("sdk", "install", "docker"), | ||
workingDir = dir, | ||
expectedExitCode = 1).stderr should include( | ||
s"""The file '${fileName}' already exists. Delete it and retry.""") | ||
} finally { | ||
file.delete() | ||
FileUtils.deleteDirectory(dir) | ||
} | ||
} | ||
|
||
it should "download ios sdk when OpenWhiskIOSStarterApp.zip exists, and ios name should be quoted in error." in { | ||
val fileName = "OpenWhiskIOSStarterApp.zip" | ||
val dir = File.createTempFile("wskinstall", ".tmp") | ||
dir.delete() | ||
dir.mkdir() should be(true) | ||
val file = new File(dir, fileName) | ||
file.createNewFile should be (true) | ||
try { | ||
wsk.cli(wskprops.overrides ++ Seq("sdk", "install", "ios"), | ||
workingDir = dir, | ||
expectedExitCode = 1).stderr should include( | ||
s"""The file '${fileName}' already exists. Delete it and retry.""") | ||
} finally { | ||
file.delete() | ||
FileUtils.deleteDirectory(dir) | ||
} | ||
} | ||
|
||
it should "download ios sdk, check filename is quoted in error when create fails." in { | ||
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 we expect the same directory permission issue with the Docker SDK?
Could test both with 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. I'll have to double check this one but last i checked i think there was no way to inject the bad permissions between the download and extraction. |
||
val fileName = "OpenWhiskIOSStarterApp.zip" | ||
val dir = File.createTempFile("wskinstall", ".tmp") | ||
dir.delete() | ||
dir.mkdir() should be(true) | ||
Seq("chmod", "555", dir.getAbsolutePath).!! | ||
try { | ||
wsk.cli(wskprops.overrides ++ Seq("sdk", "install", "ios"), | ||
workingDir = dir, | ||
expectedExitCode = 1).stderr should include( | ||
s"""Error creating SDK file '${fileName}':""") | ||
} finally { | ||
FileUtils.deleteDirectory(dir) | ||
} | ||
} | ||
|
||
it should "download docker sdk twice, check directory is quoted in error when create fails." in { | ||
val dir = File.createTempFile("wskinstall", ".tmp") | ||
dir.delete() | ||
dir.mkdir() should be(true) | ||
try { | ||
wsk.cli(wskprops.overrides ++ Seq("sdk", "install", "docker"), | ||
workingDir = dir).stdout should include( | ||
s"""The docker skeleton is now installed at the current directory.""") | ||
|
||
wsk.cli(wskprops.overrides ++ Seq("sdk", "install", "docker"), | ||
workingDir = dir, | ||
expectedExitCode = 1).stderr should include( | ||
s"""The directory 'dockerSkeleton' already exists. Delete it and retry.""") | ||
} finally { | ||
FileUtils.deleteDirectory(dir) | ||
} | ||
} | ||
|
||
it should "download iOS sdk" in { | ||
val dir = File.createTempFile("wskinstall", ".tmp") | ||
dir.delete() | ||
|
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.
Could use
Seq
to squash this test and"download ios sdk when OpenWhiskIOSStarterApp.zip exists, and ios name should be quoted in error.
into one test.