Giter VIP home page Giter VIP logo

Comments (14)

kelliepersson avatar kelliepersson commented on August 17, 2024 1

@surpher it's definitely an error on my end 😅 . I will spend more time today trying to resolve it. The problem is my Xcode will not remove the package 😩. Searched around and this seems to be a problem others have had as well. Hoping to resolve this by eod. Thanks again for all your help. Will let you know.

from pactswift.

surpher avatar surpher commented on August 17, 2024 1

I can merge it into main and not make a release. It's not a big or breaking change.

from pactswift.

surpher avatar surpher commented on August 17, 2024 1

Dug deeper into this and it looks like the interface PactSwiftMockServer uses for this is deprecated and does not support this argument.
I'll have to refactor how PactSwiftMockServer interfaces with pactffi written in rust first. It should be using handle based methods. It might take some more time to do though.

Update:
I've had a chat with pactffi maintainers that handle the core implementation written in rust and they'll try to get this argument in without needing me to refactor heaps of PactSwiftMockServer. This should help you pass your headers into your verification and buy me some time to do the refactoring moving off deprecated interfaces.
Unfortunately I'm only working on PactSwift in my spare time.

from pactswift.

surpher avatar surpher commented on August 17, 2024

@kelliepersson, have a go at this by setting the branch as your source for PactSwift dependency:

.package(
    url: "https://github.com/surpher/PactSwift.git",
    branch: "feature/provider_verification_headers_option"
)

If it works as expected I'll merge the PR (#96) and create a new release.

from pactswift.

kelliepersson avatar kelliepersson commented on August 17, 2024

@surpher Thanks so much for jumping on this so quickly!!! I am testing now. Will let you know asap.

from pactswift.

kelliepersson avatar kelliepersson commented on August 17, 2024

@surpher I am not able to get the branch to resolve the dependency,

pactswift is required using two different revision-based requirements (feature/provider_verification_headers_option and main), which is not supported

Xcode [Version 13.4.1 (13F100)] will not drop PactSwift on main branch.

from pactswift.

surpher avatar surpher commented on August 17, 2024

I'm not exactly clear how and what exactly you've updated in your project setup to be presented with that error. Sounds like a setup issue.

Editing the repository for PactSwift package and setting a branch in Xcode should work:
Screen Shot 2022-10-04 at 1 43 46 pm

Perhaps remove the package first before adding it with the reference to the branch?

from pactswift.

kelliepersson avatar kelliepersson commented on August 17, 2024

@surpher Package resolution is still failing for me. Seems PackMockServer has a dependency on main branch as well.

Screen Shot 2022-10-05 at 10 21 43 AM

from pactswift.

surpher avatar surpher commented on August 17, 2024

What sort of a project are you working on? Does it by any chance have Package.swift files but Xcode is trying to set a new separate one and there is a conflict?
All transient Pact dependencies remained set to version number.

from pactswift.

kelliepersson avatar kelliepersson commented on August 17, 2024

Thank you @surpher. I was originally trying to test this against a work project. We have Package.swift files. So instead, I just created a simple project and pointed to your branch. I was able to pass in the new customHeaders dictionary.

Finally able to get my test to run 😄, but ended up failing w/

failed - Provider Verification Error: Invalid arguments were provided to the verification process.

from pactswift.

kelliepersson avatar kelliepersson commented on August 17, 2024

@surpher this is awesome! I am glad that this surfaced this issue. I appreciate your work on this and am looking forward to the changes. For someone working in their spare time, you are on it & responsive!!! Thank you so much!

from pactswift.

kelliepersson avatar kelliepersson commented on August 17, 2024

@surpher wanted to check back in. Has there been any progress from pactffi maintainers, PactSwiftMockServer refactoring? Thanks so much.

from pactswift.

surpher avatar surpher commented on August 17, 2024

There's some progress refactoring Verifier using a handle instead of one off trigger on branch feature/provider-verification-upgrade. It has not been tested yet! Literally only created the interface but stopped at creating a test project trying to use it.
Saying that I would very much welcome any feedback on this WIP. Feel free to use what is there.

You should be able to set up provider verification by chaining the commands found on ProviderVerifier object.
Something like the following pseudo code:

func testPactVerification() {
	let verifierHandle = ProviderVerifier(name: "provider", version: "1.0.0")!
	let verificationResult = verifierHandle
		.setCustomHeaders(["Authorization": "Bearer somethingSomething"])
		.setVerificationOptions(disableSSL: true, timeout: 2)
		.setProviderInfo(name: "provider", url: URL(string: "http://localhost:8080")!)
		.verifyPactsAt(source: .file("/tmp/pacts/consumerName-providerName.json"))
		.verify()

	XCTAssertEqual(verificationResult, .success(true))
}

I'm working with the maintainers of the core Pact FFI and we've identified a few things that will need to be resolved as well, particularly when setting provider state setProviderState(url:teardown:body:) which doesn't make much sense in pact_ffi either.

from pactswift.

surpher avatar surpher commented on August 17, 2024

@kelliepersson pact_ffi and PactSwiftMockServer has finally been updated to support custom headers for non-handle implementation. Can you give it another whirl using the branch feature/provider_verification_headers_option?

from pactswift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.