keploy icon indicating copy to clipboard operation
keploy copied to clipboard

[bug]: bypass rules not working

Open re-Tick opened this issue 10 months ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current behavior

When I record test cases for gin-mongo samples-go app with the below config file, the mocks for the http at port 8080 is still recorded.

path: ""
command: "go run main.go handler.go"
port: 0
proxyPort: 16789
dnsPort: 26789
debug: false
disableTele: false
inDocker: false
generateGithubActions: true
containerName: ""
networkName: ""
buildDelay: 30s
test:
    selectedTests: {}
    globalNoise:
        global: {}
        test-sets: {}
    delay: 5
    apiTimeout: 5
    coverage: false
    goCoverage: false
    coverageReportPath: ""
    ignoreOrdering: true
    mongoPassword: "default@123"
    language: ""
    removeUnusedMocks: false
record:
    recordTimer: 0s
    stubs:
        filters:
            - port: 8080
    filters: 
        - port: 8080
        # host: "dc.services.visualstudio.com"
        # path: "/user/app"
configPath: ""
bypassRules: []
cmdType: "native"
enableTesting: false
keployContainer: "keploy-v2"
keployNetwork: "keploy-network"

# Example on using tests
#tests:
#  filters:
#   - path: "/user/app"
#     urlMethods: ["GET"]
#     headers: {
#       "^asdf*": "^test"
#     }
#     host: "dc.services.visualstudio.com"
#Example on using stubs
#stubs:
#  filters:
#   - path: "/user/app"
#     port: 8080
#   - port: 8081
#   - host: "dc.services.visualstudio.com"
#   - port: 8081
#     host: "dc.services.visualstudio.com"
#     path: "/user/app"
	#
#Example on using globalNoise
#globalNoise:
#   global:
#     body: {
#        # to ignore some values for a field,
#        # pass regex patterns to the corresponding array value
#        "url": ["https?://\S+", "http://\S+"],
#     }
#     header: {
#        # to ignore the entire field, pass an empty array
#        "Date": [],
#      }
#    # to ignore fields or the corresponding values for a specific test-set,
#    # pass the test-set-name as a key to the "test-sets" object and
#    # populate the corresponding "body" and "header" objects
#    test-sets:
#      test-set-1:
#        body: {
#          # ignore all the values for the "url" field
#          "url": []
#        }
#        header: {
#          # we can also pass the exact value to ignore for a field
#          "User-Agent": ["PostmanRuntime/7.34.0"]
#        }

Steps to reproduce

  1. Clone the samples-go
  2. Add a http get in the post handler of the Puturl
  3. Run the app in record with bypass rule config
  4. make curl request to the Post handler
  5. and the request will be generated

Environment

None

Version

Cloud

Repository

keploy

re-Tick avatar Apr 16 '24 09:04 re-Tick

@shivamsouravjha please have a look.

re-Tick avatar Apr 16 '24 09:04 re-Tick

@re-Tick seems like the flags aren't loaded. I can work on this task

shivamsouravjha avatar Apr 16 '24 09:04 shivamsouravjha