From 0b6066e1de52f303a9a6f75a52e48b82c0864e0c Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 21 Nov 2024 18:35:56 +0000 Subject: [PATCH] test: test pact with subpaths --- main.go | 2 +- user_service_test.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index e1f21e3..84fc126 100644 --- a/main.go +++ b/main.go @@ -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") } diff --git a/user_service_test.go b/user_service_test.go index 934bba6..691a2c5 100644 --- a/user_service_test.go +++ b/user_service_test.go @@ -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"), @@ -58,8 +58,6 @@ func TestPactProvider(t *testing.T) { t.Fatalf("%v", err) } - - } // Provider state handlers @@ -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)) }