dice icon indicating copy to clipboard operation
dice copied to clipboard

Set and Get tests

Open ayo-ajayi opened this issue 2 years ago • 8 comments

Wrote a test file to address the issues listed in issue #69 and #71

  1. covers the correctness of single command
  2. covers the correctness when multiple commands are fired
  3. no commands are dropped abruptly
  4. ensure we check for small, large, and massive inputs

ayo-ajayi avatar Sep 16 '23 15:09 ayo-ajayi

@JyotinderSingh what do you think about this?

arpitbbhayani avatar Jun 30 '24 14:06 arpitbbhayani

@JyotinderSingh what do you think about this?

LGTM.

nit: I prefer to use the assert library for checks for consistency, but the PR is quite old so we can do that separately.

JyotinderSingh avatar Jun 30 '24 14:06 JyotinderSingh

We can create a new branch from this branch and do the assertions by the assert lib. @ayo-ajayi 's commits will still stay and we can add the changes to master without compromising the code quality. Happy to take a stab at it.

We could also explore adding a linter check for future contributors so they will identify the concerns while pushing and will save dev and review time.

yashs360 avatar Jul 11 '24 04:07 yashs360

I can update the code to use the assert library for the tests if preferred. By assert library, do you mean: github.com/stretchr/testify/assert?

ayo-ajayi avatar Jul 11 '24 09:07 ayo-ajayi

Thats awesome @ayo-ajayi . And welcome back! You should usegotest.tools/v3/assert

Here is an example - https://github.com/DiceDB/dice/blob/master/tests/qwatch_test.go#L7

yashs360 avatar Jul 11 '24 10:07 yashs360

The test for retrieving a non-existent key (GET k_invalid) is not being executed correctly. While the command is encoded and sent, the DecodeOne function does not handle the null response returned by the database. This needs to be accounted for in the func (rp *RESPParser) DecodeOne() (interface{}, error) { implementation.

ayo-ajayi avatar Jul 16 '24 14:07 ayo-ajayi

The test for retrieving a non-existent key (GET k_invalid) is not being executed correctly. While the command is encoded and sent, the DecodeOne function does not handle the null response returned by the database. This needs to be accounted for in the func (rp *RESPParser) DecodeOne() (interface{}, error) { implementation.

Please feel free to fix bugs in other components as a part of this PR

JyotinderSingh avatar Jul 24 '24 18:07 JyotinderSingh

Hi @ayo-ajayi, are you still working on this PR?

JyotinderSingh avatar Jul 31 '24 13:07 JyotinderSingh