Skip to main content

touch_test.go

touch_test.go - Overview

This file contains tests for the TOUCH command in the ironhawk package. The TOUCH command updates the last accessed time of a key.

Detailed Documentation

TestTouch Function

Purpose: Tests the functionality of the TOUCH command, which updates the last accessed time of a key.

Parameters:

  • t: A pointer to the testing.T struct, used for running and reporting test results.

Returns: None

The test cases cover scenarios such as touching a simple value, touching multiple existing keys, and touching a mix of existing and non-existing keys. It verifies that the idle time is reset after the TOUCH command is executed.

TestCase Struct

The TestCase struct appears to be defined elsewhere, but based on its usage, it likely has the following fields:

  • name: A string describing the test case.
  • commands: A slice of strings representing the commands to be executed.
  • expected: A slice of interfaces representing the expected results of the commands.
  • delay: A slice of time.Duration values representing delays to be introduced between commands.

getLocalConnection Function

Purpose: The purpose of this function is not evident from this code. It likely establishes a local connection to the database for testing.

Parameters: None

Returns: A client connection object (type not specified in this file).

runTestcases Function

Purpose: The purpose of this function is not evident from this code. It likely executes the test cases against the client.

Parameters:

  • t: A pointer to the testing.T struct.
  • client: A client connection object.
  • testCases: A slice of TestCase structs.

Returns: None

Getting Started Relevance