Skip to content

Commit

Permalink
Merge pull request #391 from lisamcho/develop
Browse files Browse the repository at this point in the history
cleanup + improve volume service tests against flakes

[#169468213](https://www.pivotaltracker.com/story/show/169468213)
  • Loading branch information
weymanf authored Oct 30, 2019
2 parents 0283355 + e792d52 commit ea4ed90
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions volume_services/volume_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"path/filepath"
"strings"
"time"

"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
Expand Down Expand Up @@ -45,7 +46,9 @@ var _ = VolumeServicesDescribe("Volume Services", func() {
session = cf.Cf("curl", fmt.Sprintf("/routing/v1/router_groups/%s", routerGroupGuid), "-X", "PUT", "-d", payload).Wait()
Expect(session).To(Exit(0), "cannot update tcp router group to allow nfs traffic")

tcpDomain = fmt.Sprintf("tcp.%s", Config.GetAppsDomain())
randomDomain := strings.ReplaceAll(random_name.CATSRandomName("SHARED_DOMAIN"), "_", "-")

tcpDomain = fmt.Sprintf("%s.%s", randomDomain, Config.GetAppsDomain())

session = cf.Cf("create-shared-domain", tcpDomain, "--router-group", "default-tcp").Wait()
Expect(session).To(Exit(0), "can not create shared tcp domain")
Expand Down Expand Up @@ -73,7 +76,7 @@ var _ = VolumeServicesDescribe("Volume Services", func() {
Expect(session).To(Exit(0), "cannot create a tcp route mapping to the nfs server app")
})

session = cf.Cf("start", "nfs").Wait()
session = cf.Cf("start", "nfs").Wait(Config.CfPushTimeoutDuration())
Expect(session).To(Exit(0), "cannot start the nfs server app")

workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() {
Expand Down Expand Up @@ -115,22 +118,14 @@ var _ = VolumeServicesDescribe("Volume Services", func() {
})

AfterEach(func() {
Eventually(cf.Cf("delete", appName, "-f")).Should(Exit(0), "cannot delete the test app")
Eventually(cf.Cf("delete-service", serviceInstanceName, "-f")).Should(Exit(0), "cannot delete the nfs service instance")

workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() {
session := cf.Cf("disable-service-access", serviceName, "-o", TestSetup.RegularUserContext().Org).Wait()
Expect(session).To(Exit(0), "cannot disable nfs service access")
})

Eventually(cf.Cf("delete", "nfs", "-f")).Should(Exit(0), "cannot delete the nfs server app")

workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() {
payload := fmt.Sprintf(`{ "reservable_ports":"%s", "name":"default-tcp", "type": "tcp"}`, reservablePorts)
session := cf.Cf("curl", fmt.Sprintf("/routing/v1/router_groups/%s", routerGroupGuid), "-X", "PUT", "-d", payload).Wait()
Expect(session).To(Exit(0), "cannot retrieve current router groups")

session = cf.Cf("target", "-o", TestSetup.RegularUserContext().Org, "-s", TestSetup.RegularUserContext().Space).Wait()
Expect(session).To(Exit(0), "can not target space")

session = cf.Cf("delete-shared-domain", "-f", tcpDomain).Wait()
Expect(session).To(Exit(0), "can not delete shared tcp domain")
})
Expand Down

0 comments on commit ea4ed90

Please sign in to comment.