From f9b59606e998da8c997ba5d16b60bd41612838f0 Mon Sep 17 00:00:00 2001 From: Georgi Lozev Date: Tue, 6 Feb 2018 11:54:32 +0000 Subject: [PATCH] Fix integration test, to be compliant with CAPI * As part of this commit we test for a different error response when a user tries to share a service instance into a space where they do not have write permissions. * This change accommodates upstream changes in CAPI, most notably, this [PR](https://github.com/cloudfoundry/cloud_controller_ng/pull/1037) [#154916954] Signed-off-by: Alex Blease --- integration/experimental/v3_share_service_command_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/integration/experimental/v3_share_service_command_test.go b/integration/experimental/v3_share_service_command_test.go index c81ffce358d..52c5c8161d2 100644 --- a/integration/experimental/v3_share_service_command_test.go +++ b/integration/experimental/v3_share_service_command_test.go @@ -247,6 +247,7 @@ var _ = PDescribe("v3-share-service command", func() { }) Context("when I am a SpaceAuditor in the space I want to share into", func() { + var sharedToSpaceGUID string BeforeEach(func() { user := helpers.NewUsername() password := helpers.NewPassword() @@ -254,6 +255,8 @@ var _ = PDescribe("v3-share-service command", func() { Eventually(helpers.CF("set-space-role", user, sourceOrgName, sourceSpaceName, "SpaceDeveloper")).Should(Exit(0)) Eventually(helpers.CF("set-space-role", user, sharedToOrgName, sharedToSpaceName, "SpaceAuditor")).Should(Exit(0)) Eventually(helpers.CF("auth", user, password)).Should(Exit(0)) + Eventually(helpers.CF("target", "-o", sharedToOrgName, "-s", sharedToSpaceName)).Should(Exit(0)) + sharedToSpaceGUID = helpers.GetSpaceGUID(sharedToSpaceName) Eventually(helpers.CF("target", "-o", sourceOrgName, "-s", sourceSpaceName)).Should(Exit(0)) }) @@ -264,7 +267,8 @@ var _ = PDescribe("v3-share-service command", func() { It("fails with an unauthorized error", func() { session := helpers.CF("v3-share-service", serviceInstance, "-s", sharedToSpaceName, "-o", sharedToOrgName) Eventually(session).Should(Say("FAILED")) - Eventually(session.Err).Should(Say("You are not authorized to perform the requested action")) + Eventually(session.Err).Should(Say("Unable to share service instance %s with spaces \\['%s'\\].", serviceInstance, sharedToSpaceGUID)) + Eventually(session.Err).Should(Say("Write permission is required in order to share a service instance with a space")) Eventually(session).Should(Exit(1)) }) })