copy_test.go
copy_test.go - Overview
This file contains integration tests for the COPY
command in the DiceDB server. It tests various scenarios, including copying non-existent keys, copying with and without the REPLACE
option, copying different data types (string, JSON), and copying keys with expirations.
Detailed Documentation
Function: TestCopy
Purpose: Tests the COPY
command with various scenarios.
Parameters:
t
(*testing.T): Testing object for running test cases.
Returns: None
The test cases cover the following scenarios:
- Copying when the source key doesn't exist.
- Copying with and without the
REPLACE
option. - Copying with JSON integer, boolean, array and simple JSON.
- Copying with no expiry.
- Copying with expiry to ensure the copy also expires.
The test iterates through a set of test cases, each defining a series of commands to execute and expected results. It uses client.FireString
to execute commands on a local DiceDB server and asserts the results against expected values. JSON responses are compared for equality regardless of key order.
Code Examples
None
Getting Started Relevance
YES