SpectoLabs / hoverfly

Lightweight service virtualization/ API simulation / API mocking tool for developers and testers
https://hoverfly.io
Apache License 2.0
2.35k stars 208 forks source link

runners are running behind proxy, so we need to set http proxy, https proxy and no proxy variables provided by our organization so where can we set hoverfly proxy variables #1106

Open jakkshay opened 9 months ago

jakkshay commented 9 months ago

Description of the bug

runners are running behind proxy, so we need to set http proxy, https proxy and no proxy variables provided by our organization so where can we set hoverfly proxy variables

Steps to reproduce the issue

GitLab Job to run script: We are using hoverfly binary files chmod 777 hoverctl chmod 777 hoverfly ./hoverctl version ./hoverctl config ./hoverctl start --admin-port 9093 --proxy-port 9092 --disable-tls --cors -v || ls ./hoverctl logs ./hoverctl mode capture export HTTP_PROXY="http://localhost:9092" export HTTPS_PROXY="http://localhost:9092" no_proxy: $CODE_NO_PROXY npx cypress run --spec path/to/specfile ./hoverctl logs ./hoverctl export simualtion.json

We are setting proxy to our docker runner like this:

.job_template: &artifacts_cache artifacts: expire_in: 1 week when: always paths:

Observed result

We are unable to capture the hoverfly traffic Hoverfly error messages seen (If none, say none)

Hoverfly is now running
+------------+------+
| admin-port | 9093 |
| proxy-port | 9092 |
+------------+------+
INFO[2023-12-06T12:24:39Z] Default proxy port has been overwritten       port=9092
INFO[2023-12-06T12:24:39Z] Default admin port has been overwritten       port=9093
INFO[2023-12-06T12:24:39Z] CORS has been enabled                        
INFO[2023-12-06T12:24:39Z] TLS certificate verification has been disabled 
INFO[2023-12-06T12:24:39Z] Using memory backend                         
INFO[2023-12-06T12:24:39Z] Proxy prepared...                             Destination=. Mode=simulate ProxyPort=9092
INFO[2023-12-06T12:24:39Z] current proxy configuration                   destination=. mode=simulate port=9092
INFO[2023-12-06T12:24:39Z] serving proxy                                
INFO[2023-12-06T12:24:39Z] Admin interface is starting...                AdminPort=9093
Hoverfly has been set to capture mode 

 ✔  All specs passed!                        01:02        2        2        -        -        -  
Done in 71.67s.
INFO[2023-12-06T12:24:39Z] Default proxy port has been overwritten       port=9092
INFO[2023-12-06T12:24:39Z] Default admin port has been overwritten       port=9093
INFO[2023-12-06T12:24:39Z] CORS has been enabled                        
INFO[2023-12-06T12:24:39Z] TLS certificate verification has been disabled 
INFO[2023-12-06T12:24:39Z] Using memory backend                         
INFO[2023-12-06T12:24:39Z] Proxy prepared...                             Destination=. Mode=simulate ProxyPort=9092
INFO[2023-12-06T12:24:39Z] current proxy configuration                   destination=. mode=simulate port=9092
INFO[2023-12-06T12:24:39Z] serving proxy                                
INFO[2023-12-06T12:24:39Z] Admin interface is starting...                AdminPort=9093
INFO[2023-12-06T12:24:40Z] Mode has been changed                         mode=capture
Successfully exported simulation to simulation.json

Our simulation file is unable to capture the traffic and simulation file is looking like below:
{
    "data": {
        "pairs": [],
        "globalActions": {
            "delays": [],
            "delaysLogNormal": []
        }
    },
    "meta": {
        "schemaVersion": "v5.2",
        "hoverflyVersion": "v1.6.0",
        "timeExported": "2023-12-06T12:25:30Z"
    }
}

If possible, add screenshots to help explain your problem

Expected result

Hoverfly traffic should get captured

Additional relevant information

  1. Hoverfly version: v1.6.0
  2. Anything that might help us to diagnose the problem
vishallanke commented 9 months ago

Any update here ?