github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/integration/helpers/route_mapping.go (about)

     1  package helpers
     2  
     3  import (
     4  	"fmt"
     5  
     6  	. "github.com/onsi/gomega"
     7  	. "github.com/onsi/gomega/gbytes"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  // MapRouteToApplication maps a route to an app using 'cf map-route' and asserts that
    12  // the mapping exists.
    13  func MapRouteToApplication(app string, domain string, host string, path string) {
    14  	Eventually(CF("map-route", app, domain, "--hostname", host, "--path", path)).Should(Exit(0))
    15  	Eventually(CF("routes")).Should(And(Exit(0), Say(
    16  		fmt.Sprintf("%s\\s+%s\\s+/?%s\\s+.*%s.*", host, domain, path, app))))
    17  }
    18  
    19  // UnmapRouteFromApplication unmaps a route from an app using 'cf unmap-route' and asserts that
    20  // the mapping gets deleted.
    21  func UnmapRouteFromApplication(app string, domain string, host string, path string) {
    22  	Eventually(CF("unmap-route", app, domain, "--hostname", host, "--path", path)).Should(Exit(0))
    23  	session := CF("routes")
    24  	Eventually(session).Should(Exit(0))
    25  	Eventually(session).ShouldNot(Say(fmt.Sprintf("%s\\s+%s\\s+/%s\\s+%s", host, domain, path, app)))
    26  }