rabbah commented on a change in pull request #3950: Extend system testsuite
URL:
https://github.com/apache/incubator-openwhisk/pull/3950#discussion_r209892089
##########
File path: tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
##########
@@ -160,6 +160,46 @@ abstract class WskEntitlementTests extends TestHelpers
with WskTestHelpers with
}
}
+ it should "list shared packages when package is turned into public" in
withAssetCleaner(guestWskProps) {
+ (wp, assetHelper) =>
+ assetHelper.withCleaner(wsk.pkg, samplePackage) { (pkg, _) =>
+ pkg.create(samplePackage)(wp)
+ }
+
+ retry {
+ val packageList =
wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
+ verifyPackageNotSharedList(packageList, guestNamespace, samplePackage)
+ }
+
+ wsk.pkg.create(samplePackage, update = true, shared = Some(true))(wp)
+
+ retry {
+ val packageList =
wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
+ verifyPackageSharedList(packageList, guestNamespace, samplePackage)
+ }
+ }
+
+ it should "not list any packages from invalid namespace" in
withAssetCleaner(guestWskProps) { (wp, assetHelper) =>
+ val invalidNamespace = "whisk.systsdf"
+ retry {
+ val packageList = wsk.pkg.list(Some(s"/$invalidNamespace"))(wp)
+ packageList.stdout should be("[]") //empty list
+ }
+ }
+
+ it should "reject getting package from invalid namespace" in
withAssetCleaner(guestWskProps) { (wp, assetHelper) =>
+ val invalidNamespace = "whisk.systsdf"
+ wsk.pkg.get(s"/${invalidNamespace}/utils", expectedExitCode =
forbiddenCode)(wp).stderr should include(
+ "not authorized")
+ }
+
+ it should "reject getting invalid package from valid namespace" in
withAssetCleaner(guestWskProps) {
+ (wp, assetHelper) =>
+ val invalidPackage = "utilssss"
+ wsk.pkg.get(s"/whisk.system/${invalidPackage}", expectedExitCode =
forbiddenCode)(wp).stderr should include(
+ "not authorized")
+ }
Review comment:
This suggests that the swagger validation should be added to the unit tests
as well - of which there are many. Is this something we might be able to do?
Otherwise we might end up adding a lot of system level tests that do the same
thing as the unit tests.
I’m not entirely sure we can integrate swagger validation though in the unit
tests - at least not in the way Ben did it for the system tests. But I have not
researched this. I’m mentioning it in case of a black hole here that’s hard to
get out of.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services