GithubHelp home page GithubHelp logo

pact-stub-server-archived's People

Contributors

mefellows avatar pkubowicz avatar stones avatar uglyog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pact-stub-server-archived's Issues

Issue with POST since v0.0.10

We have been using the pact-stub-server in our CI systems since version v0.0.10 with great success, but noticed the new version is now broken when using our existing pact files against it.

We've noticed that if we curl a 'GET' request to a running container, it works, as do all 'GET' request interactions. However on using a 'POST' the curl request sits and does nothing, and the container does not register any connection or matching taking place as it does with a GET request. There is no output at all and the container is then non-responsive from that point after. Trying a previously working 'GET' to this container now does not work, with no container output.

We've tested this in parallel with a v0.0.10 container image, which works perfectly. As you do not appear to be maintaining a large number of previous tags in Dockerhub, we run the risk of our now pinned container image version being removed.

Any ideas why this might be the case with 'POST' requests?

Server unable to handle multiple requests

Hello,
We were using the pact-stub-server on version 0.2.1, however we realized that it's not fast enough.
Our microservice was running on springBoot and does 2 syncrhonous calls in succession, however the pact server is only able to respond to the first one, and on the second one we get a I/O error and we don't see any requests going the pact server.
It seems that the pact-server doesn't close the port quick enough? something in that matter that caused it to not being able to react fast enough to the second request.
If you want code samples or versioning please write me, We fixed it by switching to mock-server but it'd be nice if we can still use the pact-server.

Pact files with matchers in request params are not getting matched while using pact-stub-server

I have a interaction which expects the following request,

withRequest: { method: 'GET', path: '/api/objects', query: { page: somethingLike('1') } }

the pact file generated for this interaction has the following matchers,

"Get object", "request": { "method": "GET", "path": "/api/objects", "query": "page=1", "matchingRules": { "$.query.page[0]": { "match": "type" } } }

while using the stub server, i am getting the response only when i make the call with "/api/objects?page=1", when i change the request parameter value ""/api/objects?page=2" it is not getting matched, because of which no response is returned.

Please find below the logs from pact-stub-server,

===> Received request: Request { method: "GET", path: "/api/objects", query: Some({"page": ["2"]}), headers: Some({"Postman-Token": "866f0fef-1ecd-122c-801b-4480d74c63d2", "Authorization": "Basic Og==", "Accept": "/", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", "Host": "localhost:18119", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en-US,en;q=0.9,it;q=0.8", "Connection": "keep-alive", "Content-Type": "application/json", "Cache-Control": "no-cache"}), body: Empty, matching_rules: MatchingRules { rules: {} }, generators: Generators { categories: {} } }
service | 16:27:40 [INFO] body: ''
service |
service | 16:27:40 [INFO] comparing to expected request: Request { method: "GET", path: "/api/objects", query: Some({"page": ["1"]}), headers: None, body: Missing, matching_rules: MatchingRules { rules: {"query": Category { name: "query", rules: {"page[0]": RuleList { rules: [Type], rule_logic: And }} }} }, generators: Generators { categories: {} } }
service | 16:27:40 [WARN] No matching request found, sending 404 Not Found

Running of 0.1.0 (latest) docker image fails with libssl.so not found error

Hi,

On OSX 10.13.6 (High-Sierra)
Docker CE: tested on both 18.03.1-ce-mac65 (24312) and 18.06.0-ce-mac70 (26399) (both are on the stable channel)

command:

docker run -t -p 7777:7777 -v "$(pwd)/project/pacts:/app/pacts" pactfoundation/pact-stub-server -p 7777 -d pacts

fails with the following output:

/app/pact-stub-server: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

when trying with tagged image v0.0.10 it's working fine

Issue while playing video and PUT request after :v0.0.9

So , I have pact file which successfully works till v0.0.9
But when i try to upgrade the version , pact file which contains

  1. PUT request
  2. file location for loading the video is failing

Please note : other pact files are working fine .
I cant see any logs getting published to it when it is upgraded version higher than v0.0.9
Logs : Attaching to flex-master
flex-master | 13:28:43 [INFO] Server started on port 30044
flex-search-app-flex-master.txt

Also console shows 200 response but no data under response
I have uploaded the json file which is generated after running the test
Please let me know if any further information is required

Stub server provider states

Docs are suggesting you can use existing pact definitions to drive the stub server.
How do you put the server into different states?

Eg. resource exists for /item/123 but return error 404 for /item/0

Pact-stub server is matching multiple requests where no request body is provided

Issue

NB:- an example repo with this issue is available here
https://github.com/YOU54F/pact-consumer-example-typescript

Where a pact provider is setup with the following 2 request matchers

  withRequest: {
    body: requestResponse.TestRequest("happyPath"),
    headers: {
      "Content-Type": "application/json"
    },
    method: "POST",
    path: "/test"
  }
};
  withRequest: {
    body: requestResponse.TestRequest(""),
    headers: {
      "Content-Type": "application/json"
    },
    method: "POST",
    path: "/test"
  }

When a request is sent with no body, a duplicate match is found and the first result is returned

curl -X POST \
  http://localhost:8080/test \
  -H 'Content-Type: application/json'

Pact stub server logs :- [WARN] Found more than one pact request for method POST and path '/test', using the first one

Actual Result :- Returns the first matching response (false positive)
Expected Result :- Return a 404 and no body, as only a portion of the request was matched (no body)

Reproduction Steps

Versions

  • "@pact-foundation/pact": "^7.2.0",
  • pact-foundation/pact-stub-server @latest (as of 17/12/2018)

Installation

  • clone repository git clone [email protected]:YOU54F/pact-consumer-example-typescript.git
  • Run yarn install
  • Run yarn build

Run pact tests

  • Run yarn run pact-test

Start the mock server

  • Run docker-compose up

Run the following request -

curl -X POST \
  http://localhost:8080/test \
  -H 'Content-Type: application/json'

Expected Result = Returns an empty response body and a 404
Actual Result = Returns the below body and a 200

{
    "testResult": "validRequest"
}

Pact stub server logs spit out the following

[WARN] Found more than one pact request for method POST and path '/test', using the first one

Unable to pull v.0.1.1

Since yesterday we're not able to pull the older version..did something break releasing the newer version?
We've updated to v.0.2.0 and we're still working but maybe you can have a look why it's broken

Pact stub cannot match field with regular expression created from ั# .NET

Pact stub version 0.2.3

I am trying to stub some api using pact stub (I use pact file from pact broker by URL). By pact stub cannot match my api URL that contains regular expression with saved pact file.
Note: pact stab can only match path if I will replace '\' to '' in pact file.

C# test that created pact file:

[Fact]
public async Task SearchHistoryAndSettingsController_TrackingStatus_ReturnedTrue()
{
   const string path = "/api/user/tracking";
   _mockProviderService.UponReceiving("Get Tracking Status")
	   .With(new ProviderServiceRequest
	   {
		   Method = HttpVerb.Get,
		   Path = Match.Regex(path, $"(?i)({path})"), #ignore url case
		   Headers = new Dictionary<string, object>
		   {
			   { "Accept", "text/plain" }
		   },
	   })
	   .WillRespondWith(new ProviderServiceResponse
	   {
		   Status = StatusCodes.Status200OK,
		   Headers = new Dictionary<string, object>
		   {
			   { "Content-Type", "text/plain; charset=utf-8" }
		   },
		   Body = Match.Regex("true", "(?i)(true)")
	   });
	   ..
}

Pact file from pact Broker:

{
	"consumer": {
		"name": "SearchHistory"
	},
	"provider": {
		"name": "Settings"
	},
	"interactions": [
		{
			"description": "Get Tracking Status",
			"request": {
				"method": "get",
				"path": "/api/user/tracking",
				"headers": {
					"Accept": "text/plain"
				},
				"matchingRules": {
					"$.path": {
						"match": "regex",
						"regex": "(?i)(\\/api\\/user\\/tracking)"
					}
				}
			},
			"response": {
				"status": 200,
				"headers": {
					"Content-Type": "text/plain; charset=utf-8"
				},
				"body": "true",
				"matchingRules": {
					"$.body": {
						"match": "regex",
						"regex": "(?i)(true)"
					}
				}
			}
		}
	],
	"metadata": {
		"pactSpecification": {
			"version": "2.0.0"
		}
	}
}

This is error from Pact stub debug console:
10:39:01 [INFO] comparing to expected Request ( method: GET, path: /api/user/tracking, query: None, headers: Some({"Accept": "text/plain"}), body: Missing )
10:39:01 [DEBUG] pact_matching: body: ''
10:39:01 [DEBUG] pact_matching: matching_rules: MatchingRules { rules: {"path": Category { name: "path", rules: {"": RuleList { rules: [Regex("(?i)(\/api\/user\/tracking)")], rule_logic: And }} }} }
10:39:01 [DEBUG] pact_matching: generators: Generators { categories: {} }
10:39:01 [DEBUG] pact_matching::matchers: String -> String: comparing '/api/user/tracking' to '/api/user/tracking' using Regex("(?i)(\/api\/user\/tracking)")
10:39:01 [DEBUG] pact_matching: expected content type = 'text/plain', actual content type = 'text/plain'
10:39:01 [DEBUG] pact_matching: --> Mismatches: [PathMismatch { expected: "/api/user/tracking", actual: "/api/user/tracking", mismatch: "'(?i)(\/api\/user\/tracking)' is not a valid regular expression - regex parse error:\n (?i)(\/api\/user\/tracking)\n ^^\nerror: unrecognized escape sequence" }]
10:39:01 [WARN] No matching request found, sending 404 Not Found
10:39:01 [INFO] <=== Sending Response ( status: 404, headers: None, body: Missing )
10:39:01 [DEBUG] pact_stub_server::pact_support: body: ''
10:39:01 [DEBUG] pact_stub_server::pact_support: matching_rules: MatchingRules { rules: {} }
10:39:01 [DEBUG] pact_stub_server::pact_support: generators: Generators { categories: {} }
10:39:01 [DEBUG] hyper::proto::h1::io: flushed 114 bytes
10:39:01 [DEBUG] tokio_reactor: dropping I/O source: 1

Latest version doesn't start

I'm trying to start the latest Docker image (v.0.4.4) but am getting the error:

./pact-stub-server: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./pact-stub-server)

v0.4.3 works just fine.

Thanks

Nick

Lerna support

I suspect the stub server is not working with Lerna, when dependencies are hoisted.
When starting the stub server, it throws a bunch of errors. The same pact file works when dependencies are not hoisted to the root.

Has anyone been able to use it with hoisted Lerna?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.