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

test: fix appveyor build on V3 branch #613

Merged
merged 4 commits into from Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/v3/e2e/test/provider.spec.js
Expand Up @@ -9,6 +9,11 @@ server.listen(8081, () => {
console.log("Animal Profile Service listening on http://localhost:8081")
})

let pactBroker = "https://test.pact.dius.com.au"
if (process.env.CI && !process.env.APPVEYOR) {
pactBroker = "http://localhost:9292"
}

// Verify that the provider meets all consumer expectations
describe("Pact Verification", () => {
it("validates the expectations of Matching Service", () => {
Expand Down Expand Up @@ -70,9 +75,7 @@ describe("Pact Verification", () => {
},

// Fetch pacts from broker
pactBrokerUrl: process.env.CI
? "http://localhost:9292"
: "https://test.pact.dius.com.au",
pactBrokerUrl: pactBroker,

// Fetch from broker with given tags
consumerVersionTags: ["prod"],
Expand Down
27 changes: 18 additions & 9 deletions examples/v3/e2e/test/publish.js
@@ -1,31 +1,40 @@
const pact = require("@pact-foundation/pact-node")
const path = require("path")
let pactBroker = "https://test.pact.dius.com.au"
if (process.env.CI && !process.env.APPVEYOR) {
pactBroker = "http://localhost:9292"
}

let consumerVersion = "1.0."

if (process.env.APPVEYOR) {
consumerVersion = consumerVersion + process.env.APPVEYOR_BUILD_NUMBER
} else if (process.env.GITHUB_ACTIONS) {
consumerVersion = consumerVersion + process.env.GITHUB_ACTION
} else {
consumerVersion = consumerVersion + Math.floor(new Date() / 1000)
}

const opts = {
pactFilesOrDirs: [
path.resolve(
__dirname,
"../pacts/Matching Service V3-Animal Profile Service V3.json"
),
],
pactBroker: process.env.CI
? "http://localhost:9292"
: "https://test.pact.dius.com.au",
pactBroker: pactBroker,
pactBrokerUsername: "dXfltyFMgNOFZAxr8io9wJ37iUpY42M",
pactBrokerPassword: "O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1",
tags: ["prod", "test"],
consumerVersion:
"1.0." +
(process.env.TRAVIS_BUILD_NUMBER
? process.env.TRAVIS_BUILD_NUMBER
: Math.floor(new Date() / 1000)),
consumerVersion: consumerVersion,
}

pact
.publishPacts(opts)
.then(() => {
console.log("Pact contract publishing complete!")
console.log("")
if (!process.env.CI) {
if (!process.env.CI && !process.env.APPVEYOR) {
console.log("Head over to https://test.pact.dius.com.au/ and login with")
console.log("=> Username: dXfltyFMgNOFZAxr8io9wJ37iUpY42M")
console.log("=> Password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1")
Expand Down
4 changes: 2 additions & 2 deletions examples/v3/provider-state-injected/package.json
Expand Up @@ -5,8 +5,8 @@
"main": "index.js",
"scripts": {
"test": "npm run test:consumer && npm run test:provider",
"test:consumer": "jest consumer/*.test.js",
"test:provider": "jest -i --detectOpenHandles --forceExit provider/*.test.js"
"test:consumer": "jest consumer/transaction-service.test.js",
"test:provider": "jest -i --detectOpenHandles --forceExit provider/account-service.test.js"
},
"author": "",
"license": "ISC",
Expand Down