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

Certain input causes mock service to hang #7

Open
redbeard opened this issue Jan 5, 2015 · 4 comments
Open

Certain input causes mock service to hang #7

redbeard opened this issue Jan 5, 2015 · 4 comments

Comments

@redbeard
Copy link
Contributor

redbeard commented Jan 5, 2015

I'll investigate this further later, reporting so not to lose track of this bug.

When setting an expected interaction response with the following body payload, and posting to PACT, the server hangs until HTTP timeout.

Removing the regular expressions from the payload avoids the problem.

{
  "title":"Application Form",
  "questions":[
    {
      "label":"What is your name?",
      "fields":[
        {
          "type":"text",
          "placeholder":"Given name",
          "identifier":"given-name"
        },
        {
          "type":"text",
          "placeholder":"Family name",
          "identifier":"last-name"
        }
      ]
    },
    {
      "label":"What is your address?",
      "fields":[
        {
          "type":"address",
          "identifier":"address"
        }
      ]
    },
    {
      "label":"What is your tax file number?",
      "fields":[
        {
          "type":"text",
          "identifier":"tfn",
          "placeholder":"TFN",
          "validations":[
            {
              "type":"regexp",
              "expression":"([\\d]{3}[^\\d]*){3}",
              "message":"TFN requires 9 digits."
            }
          ],
          "processings":[
            {
              "type":"regexpReplace",
              "expression":"[^\\d]",
              "replace":""
            }
          ]
        }
      ]
    },
    {
      "label":"Employment history:",
      "fields":[
        {
          "type":"text",
          "placeholder":"Employer name",
          "identifier":"employer-name"
        },
        {
          "type":"city",
          "placeholder":"Employer city",
          "identifier":"employer-city"
        }
      ],
      "questions":[
        {
          "repeatable":{
            "min":1
          },
          "label":"Role in the company:",
          "fields":[
            {
              "type":"date",
              "placeholder":"Started",
              "identifier":"start-date"
            },
            {
              "type":"date",
              "placeholder":"Ended",
              "identifier":"end-date"
            },
            {
              "type":"text",
              "placeholder":"Title",
              "identifier":"role-title"
            },
            {
              "type":"text-area",
              "placeholder":"Description",
              "identifier":"role-desc"
            }
          ]
        }
      ]
    }
  ]
}
@bethesque
Copy link
Member

Bizarre, haven't had that before. One thing to look at is that it uses JSON.load(because sometimes there are embedded Ruby classes eg. Pact::Term) not JSON.parse.

@bethesque
Copy link
Member

Any news on this one?

@jbarton123
Copy link

jbarton123 commented Feb 9, 2021

Hi @bethesque - reviving an old thread here. I've noticed that this is still happening when using matchers that generate a regex pattern. I've been using the PHP Pact library and using matchers such as uuid() or dateTimeISO8601() seem to cause the service to hang.

I noticed when trying to send a curl request once it has hanged, I receive a connection refused so it is like the service has entered an unhealthy state.

What is really interesting is that this has only happened since I have hit a larger number of pacts (I have ~26 pacts to verify against now). When I remove any one of these, it seems to run ok again.

However, when I have replaced these regex matchers with the like() matcher (which I believe just checks for a matching type) this resolves the issue, the service doesn't hang and successfully verifies against all 26 pacts.

@bethesque
Copy link
Member

The uuid and dateTimeISO8601 aren't natively supported, so they must be wrappers for "terms" provided by the pact php library. Can you see if you can recreate it using https://github.com/pact-foundation/pact-ruby-standalone-e2e-example ?

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

3 participants