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

[bug]: noiseJSON in schema resolver throws error in case of empty noise string #1113

Closed
1 task done
shivamsouravjha opened this issue Nov 16, 2023 · 9 comments · Fixed by #1119
Closed
1 task done
Assignees
Labels
bug Something isn't working keploy

Comments

@shivamsouravjha
Copy link
Contributor

shivamsouravjha commented Nov 16, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

  • Incase of empty noise field string noisejson unmarshall throws error , since logs are in third app counsel the logs don't appear as expected but on printing the length of the noisejson and error.
image

Steps to reproduce

  • Use Keploy serve command to reproduce the error.
  • Run "keploy serve -c "npm test" --delay 10" in express-mongoose sample application

Environment

None

Version

Cloud

Repository

keploy

@shivamsouravjha shivamsouravjha added the bug Something isn't working label Nov 16, 2023
@shivamsouravjha shivamsouravjha self-assigned this Nov 16, 2023
@shivamsouravjha shivamsouravjha removed their assignment Nov 16, 2023
@charankamarapu
Copy link
Member

charankamarapu commented Nov 16, 2023

@AkashKumar7902 Please look into this issue. Try replicating it and resolve the bug. Please correct log too there is a miss spelt word.

@charankamarapu
Copy link
Member

@shivamsouravjha can you share the recorded test..? And have you used keploy-config? if yes please share that too.

@shivamsouravjha
Copy link
Contributor Author

@charankamarapu the misspelt word was me debugging to exact line. I didn't use the keploy-config.Also test-1 looked like

kind: Http
name: test-1
spec:
    metadata: {}
    req:
        method: GET
        proto_major: 1
        proto_minor: 1
        url: http://localhost:8000/get
        header:
            Accept: '*/*'
            Host: localhost:8000
            User-Agent: curl/7.88.1
        body: ""
        body_type: ""
        timestamp: 2023-11-16T05:25:10.337362557Z
    resp:
        status_code: 200
        header:
            Connection: keep-alive
            Content-Length: "996"
            Content-Type: application/json; charset=utf-8
            Date: Thu, 16 Nov 2023 05:25:13 GMT
            Etag: W/"3e4-2RLXvr5wTg9YQ6aH95CkYoFNuO8"
            Keep-Alive: timeout=5
            X-Powered-By: Express
        body: '{"page":1,"per_page":6,"total":12,"total_pages":2,"data":[{"id":1,"email":"george.bluth@reqres.in","first_name":"George","last_name":"Bluth","avatar":"https://reqres.in/img/faces/1-image.jpg"},{"id":2,"email":"janet.weaver@reqres.in","first_name":"Janet","last_name":"Weaver","avatar":"https://reqres.in/img/faces/2-image.jpg"},{"id":3,"email":"emma.wong@reqres.in","first_name":"Emma","last_name":"Wong","avatar":"https://reqres.in/img/faces/3-image.jpg"},{"id":4,"email":"eve.holt@reqres.in","first_name":"Eve","last_name":"Holt","avatar":"https://reqres.in/img/faces/4-image.jpg"},{"id":5,"email":"charles.morris@reqres.in","first_name":"Charles","last_name":"Morris","avatar":"https://reqres.in/img/faces/5-image.jpg"},{"id":6,"email":"tracey.ramos@reqres.in","first_name":"Tracey","last_name":"Ramos","avatar":"https://reqres.in/img/faces/6-image.jpg"}],"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}'
        body_type: ""
        status_message: ""
        proto_major: 0
        proto_minor: 0
        timestamp: 2023-11-16T05:25:15.250787218Z
    objects: []
    assertions:
        noise:
            body.total: []
            header.Date: []
    created: 1700112315
curl: |
    curl --request GET \
      --url http://localhost:8000/get \
      --header 'User-Agent: curl/7.88.1' \
      --header 'Accept: */*' \
      --header 'Host: localhost:8000' \

@charankamarapu
Copy link
Member

And also I don't think when we normally do test command, schema resolvers will not be used right..? @shivamsouravjha

@AkashKumar7902
Copy link
Member

Please assign me this issue

@shivamsouravjha
Copy link
Contributor Author

Have done so @charankamarapu , @AkashKumar7902 should just run the keploy serve <> command to reproduce the error as mentioned in steps to reproduce

@charankamarapu
Copy link
Member

@AkashKumar7902 I guess we missed to add null or some check in case of schema resolver changes. Please go through it.

@AkashKumar7902
Copy link
Member

hey @shivamsouravjha,
running the below command is throwing an error.

☁  express-mongoose [main] ⚡  keploy serve -c "npm test" --delay 10
[sudo] password for akash:     

       ▓██▓▄
    ▓▓▓▓██▓█▓▄
     ████████▓▒
          ▀▓▓███▄      ▄▄   ▄               ▌
         ▄▌▌▓▓████▄    ██ ▓█▀  ▄▌▀▄  ▓▓▌▄   ▓█  ▄▌▓▓▌▄ ▌▌   ▓
       ▓█████████▌▓▓   ██▓█▄  ▓█▄▓▓ ▐█▌  ██ ▓█  █▌  ██  █▌ █▓
      ▓▓▓▓▀▀▀▀▓▓▓▓▓▓▌  ██  █▓  ▓▌▄▄ ▐█▓▄▓█▀ █▓█ ▀█▄▄█▀   █▓█
       ▓▌                           ▐█▌                   █▌
        ▓
  
version: 2.0.0-alpha47

🐰 Keploy: 2023-11-17T18:37:19+05:30    INFO    cmd/serve.go:60         {"keploy test and mock path": "/home/akash/Desktop/githubrepo/samples-typescript/express-mongoose/keploy", "keploy testReport path": "/home/akash/Desktop/githubrepo/samples-typescript/express-mongoose/keploy/testReports"}
🐰 Keploy: 2023-11-17T18:37:23+05:30    INFO    hooks/loader.go:748     keploy initialized and probes added to the kernel.
🐰 Keploy: 2023-11-17T18:37:23+05:30    INFO    proxy/proxy.go:277      Java detected and CA already exists  {"path": "/usr/lib/jvm/java-11-openjdk-amd64/lib/security/cacerts"}
🐰 Keploy: 2023-11-17T18:37:24+05:30    INFO    proxy/proxy.go:277      Java detected and CA already exists  {"path": "/usr/lib/jvm/java-11-openjdk-amd64/lib/security/cacerts"}
🐰 Keploy: 2023-11-17T18:37:24+05:30    INFO    proxy/proxy.go:437      Keploy has hijacked the DNS resolution mechanism, your application may misbehave in keploy test mode if you have provided wrong domain name in your application code.
🐰 Keploy: 2023-11-17T18:37:24+05:30    INFO    proxy/proxy.go:451      Proxy started at port:16789
🐰 Keploy: 2023-11-17T18:37:24+05:30    INFO    proxy/proxy.go:608      starting DNS server at addr :16789
2023/11/17 18:37:24 🐰 Keploy:connect to http://localhost:6789/ for GraphQL playground

> NodeMongo@1.0.0 test
> echo "Error: no test specified" && exit 1

Error: no test specified
🐰 Keploy: 2023-11-17T18:37:25+05:30    ERROR   hooks/launch.go:526     userApplication failed to run with the following error. Please check application logs {"error": "exit status 1"}
🐰 Keploy: 2023-11-17T18:37:25+05:30    INFO    hooks/loader.go:384     Exiting keploy program gracefully.
🐰 Keploy: 2023-11-17T18:37:25+05:30    INFO    hooks/loader.go:434     eBPF resources released successfully...
🐰 Keploy: 2023-11-17T18:37:25+05:30    INFO    proxy/proxy.go:1023     Dns server stopped
🐰 Keploy: 2023-11-17T18:37:25+05:30    INFO    proxy/proxy.go:1025     proxy stopped...

@shivamsouravjha
Copy link
Contributor Author

keploy/samples-typescript#27 checkout to this branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keploy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants