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]: test mode panics in case of empty test case #1755

Open
1 task done
nehagup opened this issue Mar 29, 2024 · 1 comment · May be fixed by #1840
Open
1 task done

[bug]: test mode panics in case of empty test case #1755

nehagup opened this issue Mar 29, 2024 · 1 comment · May be fixed by #1840
Labels
bug Something isn't working Good First Issue Good for newcomers keploy

Comments

@nehagup
Copy link
Member

nehagup commented Mar 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

If there's an empty test case file the keploy test mode panics.


       ▓██▓▄
    ▓▓▓▓██▓█▓▄
     ████████▓▒
          ▀▓▓███▄      ▄▄   ▄               ▌
         ▄▌▌▓▓████▄    ██ ▓█▀  ▄▌▀▄  ▓▓▌▄   ▓█  ▄▌▓▓▌▄ ▌▌   ▓
       ▓█████████▌▓▓   ██▓█▄  ▓█▄▓▓ ▐█▌  ██ ▓█  █▌  ██  █▌ █▓
      ▓▓▓▓▀▀▀▀▓▓▓▓▓▓▌  ██  █▓  ▓▌▄▄ ▐█▓▄▓█▀ █▓█ ▀█▄▄█▀   █▓█
       ▓▌                           ▐█▌                   █▌
        ▓

version: 2.1.0-alpha1

🐰 Keploy: 2024-03-28T19:36:38+05:30 	INFO	config file not found; proceeding with flags only
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	keploy initialized and probes added to the kernel.
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	Java detected and CA already exists	{"path": "/usr/lib/jvm/java-17-openjdk-arm64/lib/security/cacerts"}
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	Java detected and CA already exists	{"path": "/usr/lib/jvm/java-17-openjdk-arm64/lib/security/cacerts"}
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	Keploy has taken control of the DNS resolution mechanism, your application may misbehave if you have provided wrong domain name in your application code.
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	Proxy started at port:16789
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	starting TCP DNS server at addr :26789
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	starting UDP DNS server at addr :26789
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	running	{"test-set": "test-set-2"}
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	stopping Keploy	{"reason": "replay completed successfully"}
🐰 Keploy: 2024-03-28T19:36:39+05:30 	INFO	proxy stopped...
🐰 Keploy: 2024-03-28T19:36:40+05:30 	INFO	eBPF resources released successfully...
🐰 Keploy: 2024-03-28T19:36:40+05:30 	ERROR	Recovered from panic	{"stack trace": "goroutine 1 [running]:\nruntime/debug.Stack()\n\t/opt/hostedtoolcache/go/1.21.8/x64/src/runtime/debug/stack.go:24 +0x64\ngo.keploy.io/server/v2/utils.Recover(0x4000426070)\n\t/home/runner/work/keploy/keploy/utils/utils.go:256 +0x118\npanic({0x10c28a0?, 0x20d4d70?})\n\t/opt/hostedtoolcache/go/1.21.8/x64/src/runtime/panic.go:914 +0x218\ngo.keploy.io/server/v2/pkg/platform/yaml/testdb.Decode(0x0, 0x0?)\n\t/home/runner/work/keploy/keploy/pkg/platform/yaml/testdb/util.go:229 +0x54\ngo.keploy.io/server/v2/pkg/platform/yaml/testdb.(*TestYaml).GetTestCases(0x400002c660, {0x1621858, 0x4002932320}, {0x40029201b4, 0xa})\n\t/home/runner/work/keploy/keploy/pkg/platform/yaml/testdb/db.go:107 +0x680\ngo.keploy.io/server/v2/pkg/service/replay.(*replayer).RunTestSet(0x4000003d40, {0x1621820?, 0x40005a8450?}, {0x40029201b4, 0xa}, {0x400057eea0, 0xa}, 0x0, 0x0)\n\t/home/runner/work/keploy/keploy/pkg/service/replay/replay.go:230 +0x2f8\ngo.keploy.io/server/v2/pkg/service/replay.(*replayer).Start(0x4000003d40, {0x1621858?, 0x40003d4af0?})\n\t/home/runner/work/keploy/keploy/pkg/service/replay/replay.go:111 +0x42c\ngo.keploy.io/server/v2/cli.Test.func2(0x4000225500?, {0x125589d?, 0x4?, 0x1255785?})\n\t/home/runner/work/keploy/keploy/cli/test.go:48 +0x1a0\ngithub.com/spf13/cobra.(*Command).execute(0x4000155b00, {0x400050b880, 0x4, 0x4})\n\t/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x66c\ngithub.com/spf13/cobra.(*Command).ExecuteC(0x4000361500)\n\t/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x320\ngithub.com/spf13/cobra.(*Command).Execute(0x1621858?)\n\t/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:992 +0x1c\nmain.start({0x1621858, 0x40003d4af0})\n\t/home/runner/work/keploy/keploy/main.go:69 +0x200\nmain.main()\n\t/home/runner/work/keploy/keploy/main.go:38 +0x24\n"}
🐰 Keploy: 2024-03-28T19:36:40+05:30 	INFO	stopping Keploy	{"reason": "Recovered from: runtime error: invalid memory address or nil pointer dereference"}

It should log a warning with - "couldn't run the test case, because ...." and continue execution with rest of the cases.

Steps to reproduce

just add an empty test case

Environment

Production

Version

Cloud

Repository

keploy

@nehagup nehagup added bug Something isn't working Good First Issue Good for newcomers labels Mar 29, 2024
@ethanwater
Copy link
Contributor

ethanwater commented Mar 31, 2024

Interesting, I'll take a look into this and see what I can do!

Update: I have provided a PR that should fix this issue.

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