From cede25a32159f60a6076bdfadf4bf6c882e488f4 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 18 Jan 2024 20:07:42 +0000 Subject: [PATCH] chore: demonstrate workaround for failing test --- .../plugins/myconsumer-myprovider-11.0.2.json | 95 ++++++++++++++ .../plugins/myconsumer-myprovider-12.0.0.json | 93 ++++++++++++++ examples/v4/plugins/package-lock.json | 120 ++++++------------ examples/v4/plugins/package.json | 2 +- examples/v4/plugins/provider.ts | 8 +- 5 files changed, 231 insertions(+), 87 deletions(-) create mode 100644 examples/v4/plugins/myconsumer-myprovider-11.0.2.json create mode 100644 examples/v4/plugins/myconsumer-myprovider-12.0.0.json diff --git a/examples/v4/plugins/myconsumer-myprovider-11.0.2.json b/examples/v4/plugins/myconsumer-myprovider-11.0.2.json new file mode 100644 index 000000000..a2eb06bf0 --- /dev/null +++ b/examples/v4/plugins/myconsumer-myprovider-11.0.2.json @@ -0,0 +1,95 @@ +{ + "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" + } +} \ No newline at end of file diff --git a/examples/v4/plugins/myconsumer-myprovider-12.0.0.json b/examples/v4/plugins/myconsumer-myprovider-12.0.0.json new file mode 100644 index 000000000..61be80460 --- /dev/null +++ b/examples/v4/plugins/myconsumer-myprovider-12.0.0.json @@ -0,0 +1,93 @@ +{ + "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" + } +} \ No newline at end of file diff --git a/examples/v4/plugins/package-lock.json b/examples/v4/plugins/package-lock.json index fd9873e7a..07a57b192 100644 --- a/examples/v4/plugins/package-lock.json +++ b/examples/v4/plugins/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@pact-foundation/pact": "11.0.2", + "@pact-foundation/pact": "12.1.2", "@types/chai": "^4.3.11", "@types/chai-as-promised": "7.1.8", "@types/mocha": "^10.0.6", @@ -157,14 +157,14 @@ } }, "node_modules/@pact-foundation/pact": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/@pact-foundation/pact/-/pact-11.0.2.tgz", - "integrity": "sha512-ki2pV4ZMOOPTi+vFlsODlvaLFfPxwtNFuFWyZjD9yyftwrbAlneuBSKQALyHJpY6Nmr2YU76dwWNmsWiFXwVCw==", + "version": "12.1.2", + "resolved": "https://registry.npmjs.org/@pact-foundation/pact/-/pact-12.1.2.tgz", + "integrity": "sha512-UNrRWX2GW3uMxR51/Pn2MPQs6tQdMYKl9AO0wKVYKoPREZmVeHSdB3yMDPzekT+XeXtUlR5WdLYzD278CaN31Q==", "dev": true, "dependencies": { - "@pact-foundation/pact-core": "^13.13.5", + "@pact-foundation/pact-core": "^14.0.1", "@types/express": "^4.17.11", - "axios": "^0.27.2", + "axios": "^1.6.1", "body-parser": "^1.20.0", "cli-color": "^2.0.1", "express": "^4.18.1", @@ -183,13 +183,13 @@ "randexp": "^0.5.3" }, "engines": { - "node": ">=10" + "node": ">=16" } }, "node_modules/@pact-foundation/pact-core": { - "version": "13.13.9", - "resolved": "https://registry.npmjs.org/@pact-foundation/pact-core/-/pact-core-13.13.9.tgz", - "integrity": "sha512-FfntecMbrfNLBrQlRShfJreOCQoBhnhOh6HOKIrCHxh5EZLJszS7w0lquoIsaa+aG2b8+jkXDnOGs4ralNeIYg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@pact-foundation/pact-core/-/pact-core-14.1.0.tgz", + "integrity": "sha512-C6SGuwVxESMlfu2tRM0zfiR0Rvz1D4P6pccnVZtcM4TrMXDVQ7LOI+fLmilsb+SgyzWSM4B+AfUKVB7Uqg+WDA==", "cpu": [ "x64", "ia32", @@ -203,13 +203,12 @@ "win32" ], "dependencies": { - "bindings": "^1.5.0", "chalk": "4.1.2", "check-types": "7.3.0", "cross-spawn": "7.0.3", "mkdirp": "1.0.0", "needle": "^3.2.0", - "node-addon-api": "^4.2.0", + "node-gyp-build": "^4.6.0", "pino": "^8.7.0", "pino-pretty": "^9.1.1", "promise-timeout": "1.3.0", @@ -225,6 +224,9 @@ "pact-provider-verifier": "bin/pact-provider-verifier.js", "pact-stub-service": "bin/pact-stub-service.js", "pactflow": "bin/pactflow.js" + }, + "engines": { + "node": ">=16" } }, "node_modules/@pact-foundation/pact-core/node_modules/rimraf": { @@ -239,16 +241,6 @@ "rimraf": "bin.js" } }, - "node_modules/@pact-foundation/pact/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dev": true, - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -578,15 +570,6 @@ "node": ">=8" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -1232,12 +1215,6 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dev": true }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2149,11 +2126,16 @@ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", "dev": true }, - "node_modules/node-addon-api": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", - "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", - "dev": true + "node_modules/node-gyp-build": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz", + "integrity": "sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==", + "dev": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } }, "node_modules/normalize-path": { "version": "3.0.0", @@ -3345,14 +3327,14 @@ } }, "@pact-foundation/pact": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/@pact-foundation/pact/-/pact-11.0.2.tgz", - "integrity": "sha512-ki2pV4ZMOOPTi+vFlsODlvaLFfPxwtNFuFWyZjD9yyftwrbAlneuBSKQALyHJpY6Nmr2YU76dwWNmsWiFXwVCw==", + "version": "12.1.2", + "resolved": "https://registry.npmjs.org/@pact-foundation/pact/-/pact-12.1.2.tgz", + "integrity": "sha512-UNrRWX2GW3uMxR51/Pn2MPQs6tQdMYKl9AO0wKVYKoPREZmVeHSdB3yMDPzekT+XeXtUlR5WdLYzD278CaN31Q==", "dev": true, "requires": { - "@pact-foundation/pact-core": "^13.13.5", + "@pact-foundation/pact-core": "^14.0.1", "@types/express": "^4.17.11", - "axios": "^0.27.2", + "axios": "^1.6.1", "body-parser": "^1.20.0", "cli-color": "^2.0.1", "express": "^4.18.1", @@ -3369,33 +3351,20 @@ "pkginfo": "^0.4.1", "ramda": "^0.28.0", "randexp": "^0.5.3" - }, - "dependencies": { - "axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dev": true, - "requires": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - } } }, "@pact-foundation/pact-core": { - "version": "13.13.9", - "resolved": "https://registry.npmjs.org/@pact-foundation/pact-core/-/pact-core-13.13.9.tgz", - "integrity": "sha512-FfntecMbrfNLBrQlRShfJreOCQoBhnhOh6HOKIrCHxh5EZLJszS7w0lquoIsaa+aG2b8+jkXDnOGs4ralNeIYg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@pact-foundation/pact-core/-/pact-core-14.1.0.tgz", + "integrity": "sha512-C6SGuwVxESMlfu2tRM0zfiR0Rvz1D4P6pccnVZtcM4TrMXDVQ7LOI+fLmilsb+SgyzWSM4B+AfUKVB7Uqg+WDA==", "dev": true, "requires": { - "bindings": "^1.5.0", "chalk": "4.1.2", "check-types": "7.3.0", "cross-spawn": "7.0.3", "mkdirp": "1.0.0", "needle": "^3.2.0", - "node-addon-api": "^4.2.0", + "node-gyp-build": "^4.6.0", "pino": "^8.7.0", "pino-pretty": "^9.1.1", "promise-timeout": "1.3.0", @@ -3688,15 +3657,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -4210,12 +4170,6 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dev": true }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -4880,10 +4834,10 @@ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", "dev": true }, - "node-addon-api": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", - "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", + "node-gyp-build": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz", + "integrity": "sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==", "dev": true }, "normalize-path": { diff --git a/examples/v4/plugins/package.json b/examples/v4/plugins/package.json index 6479d5a59..1a85d7517 100644 --- a/examples/v4/plugins/package.json +++ b/examples/v4/plugins/package.json @@ -12,7 +12,7 @@ "author": "matt.fellows@onegeek.com.au", "license": "MIT", "devDependencies": { - "@pact-foundation/pact": "11.0.2", + "@pact-foundation/pact": "12.1.2", "@types/chai": "^4.3.11", "@types/chai-as-promised": "7.1.8", "@types/mocha": "^10.0.6", diff --git a/examples/v4/plugins/provider.ts b/examples/v4/plugins/provider.ts index 1927d680f..7170f705c 100644 --- a/examples/v4/plugins/provider.ts +++ b/examples/v4/plugins/provider.ts @@ -15,10 +15,12 @@ export const startTCPServer = ( console.log(`received TCP socket error: ${err}. Error will be ignored`); }); sock.on('data', (data) => { - const msg = parseMattMessage(data.toString()); + const msg = parseMattMessage(data.toString()) + const v12_decoded_msg = parseMattMessage(atob(msg)) + console.log("v12_decoded_msg",v12_decoded_msg) - if (msg === 'hellotcp') { - sock.write(generateMattMessage('tcpworld')); + if (v12_decoded_msg === 'hellotcp') { + sock.write(btoa(generateMattMessage('tcpworld'))); } else { sock.write(generateMattMessage('message not understood')); }