dice icon indicating copy to clipboard operation
dice copied to clipboard

Integration tests for Playground CLI requests

Open lucifercr07 opened this issue 1 year ago • 15 comments

Description

DiceDB Playground is an interactive platform that allows users to experiment with DiceDB commands in a live environment, similar to the Go Playground. Users will be able to submit and execute commands directly through a web interface. The initial implementation will focus on enabling users to search for and trigger commands.
For more details about DiceDB playground you can check here.

As part of this task we need to enhance unit tests and integration tests for /cli API. This task would be extension of https://github.com/DiceDB/dice/issues/727

Details

Validation:

  • Validate the incoming request to ensure required parameters (key, value, COMMAND_NAME) are provided.
  • Ensure appropriate HTTP response codes are returned based on success or failure scenarios.

Testing:

  • Unit tests for the new /cli handler to cover success and failure scenarios.
  • Integration tests that send various DiceDB commands via the CLI endpoint and check for correct responses.

lucifercr07 avatar Sep 26 '24 13:09 lucifercr07

Dependent on https://github.com/DiceDB/dice/issues/727

lucifercr07 avatar Sep 26 '24 13:09 lucifercr07

Can I Take this up once it is implemented?

karandixit10 avatar Sep 26 '24 13:09 karandixit10

@karandixit10 assigned, thanks for contributing. Please let me know if any other details required. Also you can collaborate with assignee of other issue.

lucifercr07 avatar Sep 26 '24 13:09 lucifercr07

@karandixit10 please let us know if you require any help with this.

lucifercr07 avatar Oct 01 '24 19:10 lucifercr07

@karandixit10 please let us know if you require any help with this.

I'll try to add this by EOD

karandixit10 avatar Oct 02 '24 12:10 karandixit10

Hi @lucifercr07 Do I have to create a mock DiceDB client to isolate the HTTP handler for Unit tests?

karandixit10 avatar Oct 02 '24 13:10 karandixit10

And will the folder structure for integration_tests be same as DiceDB tests?

karandixit10 avatar Oct 02 '24 13:10 karandixit10

@karandixit10 we can keep the same.

lucifercr07 avatar Oct 02 '24 16:10 lucifercr07

Hi @lucifercr07 for integration test I have to run DiceDB server in the terminal so will it fail in the CI when pushed?

karandixit10 avatar Oct 04 '24 16:10 karandixit10

Hello @karandixit10,

There has been no activity on this issue for the past 5 days. It would be awesome if you keep posting updates to this issue so that we know you are actively working on it.

We are really eager to close this issue at the earliest, hence if we continue to see the inactivity, we will have to reassign the issue to someone else. We are doing this to ensure that the project maintains its momentum and others are not blocked on this work.

Just drop a comment with the current status of the work or share any issues you are facing. We can always chip in to help you out.

Thanks again.

arpitbbhayani avatar Oct 24 '24 13:10 arpitbbhayani

Hi @lucifercr07 ,

I’ve reviewed the requirements for enhancing integration tests for the Playground CLI requests. I’m familiar with the dependencies and test structure for DiceDB. I’d like to take this up and ensure comprehensive validation, unit tests, and integration tests for the /cli API.

Please assign this issue to me so I can get started.

piyushhhxyz avatar Nov 24 '24 14:11 piyushhhxyz

Hey @lucifercr07 @JyotinderSingh , I've a doubt regarding this issue, for writing the tests, those have to be written for playground-mono/internal/server/http.go, am I correct?

yaten2302 avatar Jan 04 '25 06:01 yaten2302

Hey @lucifercr07 @JyotinderSingh , I've a doubt regarding this issue, for writing the tests, those have to be written for playground-mono/internal/server/http.go, am I correct?

Yes, just ensure all edge cases and happy paths are being tested

JyotinderSingh avatar Jan 04 '25 12:01 JyotinderSingh

Thanks! I'll create a PR for this soon 👍

yaten2302 avatar Jan 04 '25 17:01 yaten2302

Hey @JyotinderSingh , I've a doubt in here, that while I was trying to test the CliHandler(...) func, my proposed workflow is as follows:

  1. Setup diceCmd as created in http.go at this line.
  2. I've then check that if err != nil, then I've to return an err.
  3. Then, on this line, as mentioned here, it executes the diceCmd, similarly this command must be executed in the test environment and any error should be returned(if present)?

Could you please have a look at my workflow and guide that if it's correct?

yaten2302 avatar Jan 06 '25 07:01 yaten2302