Skip to content

Commit

Permalink
test: test pact with subpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Nov 21, 2024
1 parent d79911b commit 0b6066e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import "github.com/gin-gonic/gin"

func main() {
router := gin.Default()
router.GET("/product/:id", GetProduct)
router.GET("/bar/product/:id", GetProduct)
router.Run("localhost:8080")
}
6 changes: 2 additions & 4 deletions user_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestPactProvider(t *testing.T) {
// Verify the Provider - fetch pacts from PactFlow
verifyRequest := provider.VerifyRequest{
Provider: "pactflow-example-provider-golang",
ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d", port),
ProviderBaseURL: fmt.Sprintf("http://127.0.0.1:%d/bar", port),
BrokerToken: os.Getenv("PACT_BROKER_TOKEN"),
BrokerUsername: os.Getenv("PACT_BROKER_USERNAME"),
BrokerPassword: os.Getenv("PACT_BROKER_PASSWORD"),
Expand Down Expand Up @@ -58,8 +58,6 @@ func TestPactProvider(t *testing.T) {
t.Fatalf("%v", err)
}



}

// Provider state handlers
Expand All @@ -77,7 +75,7 @@ var stateHandlers = models.StateHandlers{
// Starts the provider API with hooks for provider states.
func startProvider() {
router := gin.Default()
router.GET("/product/:id", GetProduct)
router.GET("/bar/product/:id", GetProduct)

router.Run(fmt.Sprintf(":%d", port))
}
Expand Down

0 comments on commit 0b6066e

Please sign in to comment.