pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.62k stars 343 forks source link

Deps/pact core 14.1.0 #1166

Closed YOU54F closed 8 months ago

YOU54F commented 8 months ago

Issue found

Unrelated to this upgrade but I've noted the following, demonstrated in this commit which passes CI.

V4 Plugin provider verification test fails between pact-js 11.x (11.0.2) and 12.x (12.0.0)

The difference being 11.x has interactions[0].request.contents.encoded as false The difference being 12.x has interactions[0].request.contents.encoded as base64

with interactions[0].request.contents.content being base64 encoded in 12.x

11.0.2

{
  "consumer": {
    "name": "myconsumer"
  },
  "interactions": [
    {
      "description": "a MATT message",
      "key": "daf974126abe44c0",
      "pending": false,
      "request": {
        "contents": {
          "content": "MATThellotcpMATT",
          "contentType": "application/matt",
          "contentTypeHint": "DEFAULT",
          "encoded": false
        }
      },
      "response": [
        {
          "contents": {
            "content": "MATTtcpworldMATT",
            "contentType": "application/matt",
            "contentTypeHint": "DEFAULT",
            "encoded": false
          }
        }
      ],
      "transport": "matt",
      "type": "Synchronous/Messages"
    },
    {
      "description": "an HTTP request to /matt",
      "key": "b6c5b973534175ec",
      "pending": false,
      "providerStates": [
        {
          "name": "the Matt protocol exists"
        }
      ],
      "request": {
        "body": {
          "content": "MATThelloMATT",
          "contentType": "application/matt",
          "contentTypeHint": "DEFAULT",
          "encoded": false
        },
        "headers": {
          "content-type": [
            "application/matt"
          ]
        },
        "method": "POST",
        "path": "/matt"
      },
      "response": {
        "body": {
          "content": "MATTworldMATT",
          "contentType": "application/matt",
          "contentTypeHint": "DEFAULT",
          "encoded": false
        },
        "headers": {
          "content-type": [
            "application/matt"
          ]
        },
        "status": 200
      },
      "type": "Synchronous/HTTP"
    }
  ],
  "metadata": {
    "pact-js": {
      "version": "11.0.2"
    },
    "pactRust": {
      "ffi": "0.4.0",
      "mockserver": "0.9.8",
      "models": "1.0.4"
    },
    "pactSpecification": {
      "version": "4.0"
    },
    "plugins": [
      {
        "configuration": {},
        "name": "matt",
        "version": "0.0.7"
      }
    ]
  },
  "provider": {
    "name": "myprovider"
  }
}
{
  "consumer": {
    "name": "myconsumer"
  },
  "interactions": [
    {
      "description": "a MATT message",
      "pending": false,
      "request": {
        "contents": {
          "content": "TUFUVGhlbGxvdGNwTUFUVA==",
          "contentType": "application/matt",
          "contentTypeHint": "DEFAULT",
          "encoded": "base64"
        }
      },
      "response": [
        {
          "contents": {
            "content": "TUFUVHRjcHdvcmxkTUFUVA==",
            "contentType": "application/matt",
            "contentTypeHint": "DEFAULT",
            "encoded": "base64"
          }
        }
      ],
      "transport": "matt",
      "type": "Synchronous/Messages"
    },
    {
      "description": "an HTTP request to /matt",
      "pending": false,
      "providerStates": [
        {
          "name": "the Matt protocol exists"
        }
      ],
      "request": {
        "body": {
          "content": "TUFUVGhlbGxvTUFUVA==",
          "contentType": "application/matt",
          "contentTypeHint": "DEFAULT",
          "encoded": "base64"
        },
        "headers": {
          "content-type": [
            "application/matt"
          ]
        },
        "method": "POST",
        "path": "/matt"
      },
      "response": {
        "body": {
          "content": "TUFUVHdvcmxkTUFUVA==",
          "contentType": "application/matt",
          "contentTypeHint": "DEFAULT",
          "encoded": "base64"
        },
        "headers": {
          "content-type": [
            "application/matt"
          ]
        },
        "status": 200
      },
      "type": "Synchronous/HTTP"
    }
  ],
  "metadata": {
    "pact-js": {
      "version": "12.0.0"
    },
    "pactRust": {
      "ffi": "0.4.12",
      "mockserver": "1.2.4",
      "models": "1.1.14"
    },
    "pactSpecification": {
      "version": "4.0"
    },
    "plugins": [
      {
        "configuration": {},
        "name": "matt",
        "version": "0.0.7"
      }
    ]
  },
  "provider": {
    "name": "myprovider"
  }
}
mefellows commented 8 months ago

Thanks Saf. I can't comment as to whether that's correct or not, would need to dive into it a bit more. It could be that because the latter version of the matt plugin uses a latter Plugin interface that corrected a bug?

UPDATE: looked at the Matt plugin, nothing in there that would change that. I suspect it's an internal change (in the core) to how the library works.

YOU54F commented 8 months ago

UPDATE: looked at the Matt plugin, nothing in there that would change that. I suspect it's an internal change (in the core) to how the library works.

Yeah I need to go digging in the core release notes and check if that is intentional and on the end user / plugin author to update or if its a regression. Will cover that yak shave shortly :) I can replicate the same in pact-go, which is on 0.4.5 currently, and its easier to do so, as it doesn't use an intermediary like pact-js relies on pact-js-core, so I can pinpoint which release introduced it, and work out what we need to do about it from there :)