expiretime_test.go
expiretime_test.go - Overview
This file contains tests for the EXPIRETIME
command in the ironhawk
package. It tests various scenarios, including successful retrieval of expiration time, non-existent keys, past expiration times, and invalid syntax.
Detailed Documentation
TestEXPIRETIME
Purpose: Tests the functionality of the EXPIRETIME
command.
Parameters:
t
(*testing.T): Testing object for running the test.
Returns:
None.
The function defines a series of test cases, each consisting of a name, a list of commands to execute, and the expected results. It then iterates through these test cases, executing the commands against a local DiceDB connection and verifying that the actual results match the expected results.
TestCase
struct (inferred)
Although not explicitly defined in this file, the TestCase
struct is used within the TestEXPIRETIME
function, implying its structure.
Purpose: Structure for defining test cases
Fields (inferred):
name
(string): Name of the test case.commands
([]string): Slice of commands to execute.expected
([]interface{}), Expected results for each command.
getLocalConnection
function (inferred)
Although not explicitly defined in this file, the getLocalConnection
function is used within the TestEXPIRETIME
function, implying its existence in another file.
Purpose: Likely establishes a connection to a local DiceDB instance for testing.
Parameters:
None.
Returns:
A connection object (type not specified).
runTestcases
function (inferred)
Although not explicitly defined in this file, the runTestcases
function is used within the TestEXPIRETIME
function, implying its existence in another file.
Purpose: Executes a series of test cases against a DiceDB client and verifies the results.
Parameters:
t
(*testing.T): Testing object for running the test.client
: DiceDB client connection.testCases
([]TestCase
): Slice of test cases to execute.
Returns:
None.