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

Ersatz proxy support in 3.x #167

Closed
radarsh opened this issue Apr 3, 2023 · 9 comments
Closed

Ersatz proxy support in 3.x #167

radarsh opened this issue Apr 3, 2023 · 9 comments
Assignees

Comments

@radarsh
Copy link

radarsh commented Apr 3, 2023

I have been a long time user of this library and now I am looking at migrating from 1.9.x to the latest 3.x version. The main blocker preventing me from doing so is the lack of support for ErsatzProxy. Granted, I don't have as many tests utilising ErsatzProxy as I have using ErsatzServer but those handful of tests are still important for my application as they test that code processes proxy settings correctly and that the actual proxied endpoint is invoked.

The code that is being tested using ErsatzProxy is being relied on by hundreds of developers in a large enterprise which in turn is used to develop products that affects millions of users globally, in case you were wondering about the appetite.

I am basically coming to this issue from https://cjstehno.github.io/ersatz/docs/user_guide.html#_migrating_to_3_0 where you asked us to show interest in the form of an issue or discussion.

So, can we please have it back in 3.x? Thanks.

@cjstehno cjstehno self-assigned this Apr 3, 2023
@cjstehno
Copy link
Owner

cjstehno commented Apr 3, 2023

I'll see what I can do.

@cjstehno
Copy link
Owner

cjstehno commented Apr 3, 2023

Actually, it was basically a stand-alone component anyway, it should not be a big deal to rebuild it. I will add it to the next release. If I can pull together some time, I will see if I can cut a release within a month or two.

@radarsh
Copy link
Author

radarsh commented Apr 3, 2023

Thank you. Really appreciate the work you do with this library.

@cjstehno cjstehno added this to the v3.2.0 milestone Apr 4, 2023
@cjstehno
Copy link
Owner

cjstehno commented Apr 4, 2023

Just curious, is is this an open source project, or would you be interested in building off a branch and trying it out when it's ready?

@radarsh
Copy link
Author

radarsh commented Apr 4, 2023

It's not an open source project unfortunately but I would be happy to build off a branch and try it out internally.

@cjstehno
Copy link
Owner

I had an idea for what I feel is a better version of the old proxy server, and I'd like to see if it would satisfy your use case.

I am adding a "forwarding" feature as a new type of response provider in the main expectations API, so that you could configure something like the following:

ersatz.expectations(expect -> {
    expect.GET("/some/path", req -> {
        // optional request matching
        req.forward("http://someother:1234");
    });
});

which would forward the request to the provided host/port and then return its response as the returned response. To me this seems like it would accomplish the same thing as the old proxy, but you'd also get the request matching for free.

Is there something in your case that I am misunderstanding?

Note: if its a matter of changing a lot of test config - I could bring back the old style as well for a release (deprecated) so that you'd have time to change things over. I am more interested in whether this idea can eventually replace it.

@cjstehno
Copy link
Owner

@radarsh You can checkout the new-proxy-impl branch and see if that will take care of your use case. Note that I am doing what I mentioned above - the stand-alone proxy server will be around until release 4.0 and then it will be removed again. Please let me know if the new "forwarding" functionality will work for you, and if not, what is missing?

Unless you find anything, I will plan on cutting the 3.2 release sometime next week.

@cjstehno
Copy link
Owner

This has been added to release 3.2, which will be released on Monday.

@cjstehno
Copy link
Owner

The 3.2 release has been published to the maven central repo - it may take some time to fully propagate.

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

2 participants