Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect /verify response text when atLeast is not met #1789

Open
MosheElisha opened this issue Aug 22, 2023 · 0 comments
Open

Incorrect /verify response text when atLeast is not met #1789

MosheElisha opened this issue Aug 22, 2023 · 0 comments

Comments

@MosheElisha
Copy link

Describe the issue

My MockServer recorded 160 requests properly:

curl -X PUT "[http://sig2-mock-server:1080/mockserver/retrieve"](http://sig2-mock-server:1080/mockserver/retrieve%22)  -d '{                                                        
    "path": "/mece/b2f5a77a-19ea-484c-ab02-7d16039640fe/b0e5f359-2043-4b2b-a558-043757506272"
}' > requests.json

grep "rawBytes" requests.json | wc -l
160

Attached: requests.json.zip

When invoking verify with atLeast <= 160, the API works properly:

curl  -X PUT "http://sig2-mock-server:1080/mockserver/verify" -i -d '{                                                  
    "httpRequest": {
        "path": "/mece/b2f5a77a-19ea-484c-ab02-7d16039640fe/b0e5f359-2043-4b2b-a558-043757506272"    },
    "times": {
        "atLeast": 160
    }
}'

HTTP/1.1 202 Accepted

When invoking verify with atLeast > 160, the text in the response "but was not found, found 160 other requests" is incorrect and confusing:

curl  -X PUT "http://sig2-mock-server:1080/mockserver/verify" -i -d '{                                                  
    "httpRequest": {
        "path": "/mece/b2f5a77a-19ea-484c-ab02-7d16039640fe/b0e5f359-2043-4b2b-a558-043757506272"    },
    "times": {
        "atLeast": 161
    }
}'

HTTP/1.1 406 Not Acceptable
content-type: text/plain; charset=utf-8
version: 5.15.0
content-length: 189
x-envoy-upstream-service-time: 19
date: Tue, 22 Aug 2023 14:56:06 GMT
server: envoy
 

Request not found at least 161 times, expected:<{
  "path" : "/mece/b2f5a77a-19ea-484c-ab02-7d16039640fe/b0e5f359-2043-4b2b-a558-043757506272"
}> but was not found, found 160 other requests

What you are trying to do
Verifying that MockServer got at least X requests and if not, know how much it got.

MockServer version
5.15.0

Expected behaviour
I would expect that in case verification failed, the response text will say something like:

Request not found at least 161 times, expected:<{
  "path" : "/mece/b2f5a77a-19ea-484c-ab02-7d16039640fe/b0e5f359-2043-4b2b-a558-043757506272"
}> but found 160 requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant