twitter-archive / diffy

Find potential bugs in your services with Diffy
https://twitter.com/diffyproject
Apache License 2.0
3.83k stars 368 forks source link

Added support to send different headers, apiRoot and different query param values to candidate, primary and secondary servers #43

Open sukalpomitra opened 8 years ago

sukalpomitra commented 8 years ago

You can send different HTTP Header Key value pairs to candidate, primary and secondary servers. Add -candidateHeaders=Authorization:Basic OtxGHYUI, userRole:admin1 -primaryHeaders=Authorization:Basic NjhmskT, userRole:admin2 -secondaryHeaders=Authorization:Basic Tysfdg, userRole:admin3 to your command line arguments

You can add apiRoots to the api calls to candidate, primary and secondary servers. Add -candidateApiRoot="api/v2" -primaryApiRoot="api/v1" -secondaryApiroot="api/v1" to your command line arguments. Usage:- curl 'localhost:8880/getAllMessages' will send a request candidateServer:candidatePort/api/v2/getAllMessages to candidate server while it will send primaryServer:primaryPort/api/v1/getAllMessages to primary server

You can now substitute different queryParam values before multicasting to the three different servers. Usage:- curl 'localhost:8880/api/getUserMessages?message=userId'. Create a file apiParams.xml with the following structure `

12 13 14
</apiParams>

This will send a requestcandidateServer:candidatePort/api/getUserMessages?message=12to candidate server while sendingprimaryServer:primaryPort/api/getUserMessages?message=13andsecondaryServer:secondaryPort/api/getUserMessages?message=14` request to primary and secondary servers respectively.

sukalpomitra commented 8 years ago

hi @puneetkhanduri these two tests failed on my local machine too. But I donot know why. The changes I have done should not effect those test cases.

sukalpomitra commented 8 years ago

Ok figured out why the test cases were failing. While I was treating the request as HttpRequest the test case was sending string. Added a check to execute my code only when the request is an HttpRequest. Test cases are passing now. Willc ommit soon.

sukalpomitra commented 8 years ago

hi @puneetkhanduri I think now the coverage test is failing. Don't understand why from the logs though.

codecov-io commented 8 years ago

Current coverage is 36.59%

Merging #43 into master will increase coverage by <.01%

  1. 6 files (not in diff) in ...la/com/twitter/diffy were modified. more
    • Misses +1
    • Hits -1
@@             master        #43   diff @@
==========================================
  Files            29         29          
  Lines           789        850    +61   
  Methods         772        833    +61   
  Messages          0          0          
  Branches         17         17          
==========================================
+ Hits            288        311    +23   
- Misses          501        539    +38   
  Partials          0          0          

Powered by Codecov. Last updated by 8586972...18507a3

sukalpomitra commented 8 years ago

I will try to find some time and do the changes suggested

savakarv commented 7 years ago

@sukalpomitra This PR is still open. Did you figure out a different way to send headers? I am trying out diffy and I met with this requirement of sending headers. cc @puneetkhanduri

sukalpomitra commented 5 years ago

@savakarv I moved on to other projects and did not have time to fix it. Why dont you fork mine and continue.

CLAassistant commented 5 years ago

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

:x: sukalpo.mitra
:x: sukalpomitra


sukalpo.mitra seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.