test_dataset.py


Overview

The test_dataset.py file contains a suite of automated test functions designed to validate the behavior and robustness of dataset management operations within the InfiniFlow system. It tests dataset creation, listing, deletion, updates, and handling of edge cases such as duplicated or invalid dataset names.

The tests primarily interact with dataset-related API functions imported from the common module:

These tests ensure the dataset management layer behaves as expected under normal and boundary conditions, validating both success and failure scenarios.


Detailed Descriptions of Functions

1. test_dataset(get_auth)

Purpose:
Test basic dataset creation, listing, and deletion functionality.

Parameters:

Workflow:

Assertions:

Usage example:

test_dataset(get_auth_token)

2. test_dataset_1k_dataset(get_auth)

Purpose:
Stress test dataset creation, listing, and deletion by creating 1000 datasets.

Parameters:

Workflow:

Assertions:

Usage example:

test_dataset_1k_dataset(get_auth_token)

3. test_duplicated_name_dataset(get_auth)

Purpose:
Test the system's handling of multiple datasets with the same base name.

Parameters:

Workflow:

Assertions:

Usage example:

test_duplicated_name_dataset(get_auth_token)

4. test_invalid_name_dataset(get_auth)

Purpose:
Verify the system rejects invalid dataset names.

Parameters:

Tests performed:

Expected result:
All attempts fail with error code 102.

Usage example:

test_invalid_name_dataset(get_auth_token)

5. test_update_different_params_dataset_success(get_auth)

Purpose:
Test successful update of a dataset with various parameters.

Parameters:

Workflow:

Assertions:

Usage example:

test_update_different_params_dataset_success(get_auth_token)

6. test_update_different_params_dataset_fail(get_auth)

Purpose:
Test failure case when updating a dataset with invalid parameters.

Parameters:

Workflow:

Assertions:

Usage example:

test_update_different_params_dataset_fail(get_auth_token)

Important Implementation Details


Interaction with Other Parts of the System


Visual Diagram: Structure of test_dataset.py

classDiagram
    class test_dataset {
        +test_dataset(get_auth)
        +test_dataset_1k_dataset(get_auth)
        +test_duplicated_name_dataset(get_auth)
        +test_invalid_name_dataset(get_auth)
        +test_update_different_params_dataset_success(get_auth)
        +test_update_different_params_dataset_fail(get_auth)
    }

    %% Utility functions imported from common
    class common {
        +create_dataset(auth, name)
        +list_dataset(auth, page_number)
        +rm_dataset(auth, dataset_id)
        +update_dataset(auth, json_req)
        +DATASET_NAME_LIMIT
    }

    test_dataset ..> common : uses

Summary

test_dataset.py is a focused test suite file validating the core dataset management operations in the InfiniFlow platform. It systematically tests creation, listing, deletion, updates, and error handling, ensuring the dataset API behaves correctly under various scenarios. The file relies on the common module for actual API calls and requires authentication credentials injected through the get_auth parameter. Its thorough tests and assertions help maintain the stability and correctness of the dataset subsystem.