Test Scenarios for UPDATE and DELETE Layer APIs
UPDATE LAYER API Test Scenarios
A. Positive Scenarios (8 tests)
- test_update_layer_change_tunables - Update layer with modified tunables (add/remove/modify)
- test_update_layer_change_bounds - Update tunable bounds (upper_bound, lower_bound, step)
- test_update_layer_change_presence_type - Change from presence='always' to queries
- test_update_layer_add_queries - Add new queries to existing layer
- test_update_layer_modify_queries - Modify existing query strings
- test_update_layer_change_details - Update layer details/description
- test_update_layer_add_tunable - Add new tunable to existing layer
- test_update_layer_remove_tunable - Remove tunable from layer
B. Negative Scenarios (12 tests)
- test_update_layer_non_existent - Update layer that doesn't exist (404)
- test_update_layer_empty_name - Update with empty layer_name
- test_update_layer_null_tunables - Update with null tunables array
- test_update_layer_invalid_tunable_bounds - Update with invalid bounds
- test_update_layer_duplicate_tunable_names - Update creating duplicate tunable names
- test_update_layer_remove_all_tunables - Update removing all tunables (should fail)
- test_update_layer_invalid_presence_config - Update with invalid layer_presence
- test_update_layer_name_mismatch - URL name != body name
- test_update_layer_missing_required_fields - Update missing mandatory fields
- test_update_layer_invalid_query_syntax - Update with invalid PromQL
- test_update_layer_change_to_invalid_value_type - Change tunable value_type incorrectly
- test_update_layer_with_experiments_active - Update layer currently used in active experiments
C. Validation Scenarios (6 tests)
- test_update_layer_preserves_metadata - Verify metadata is preserved
- test_update_layer_version_increment - Check if version is incremented: Skipped for now
- test_update_layer_audit_trail - Verify update is logged/audited : Requires infrastructure (logs/audit tables). Not suitable for API functional tests
- test_update_layer_partial_update - Update only specific fields
- test_update_layer_idempotency - Same update twice should be idempotent
- test_update_layer_concurrent_updates - Handle concurrent update requests : Not being implemented now due Complexity in implementing. Better as performance/stress test
D. Edge Cases (4 tests)
- test_update_layer_very_large_payload - Update with large number of tunables
- test_update_layer_special_characters - Update with special chars in strings
- test_update_layer_unicode_content - Update with unicode characters
DELETE LAYER API Test Scenarios
A. Positive Scenarios (5 tests)
- test_delete_layer_success - Delete existing layer successfully
- test_delete_layer_verify_removal - Verify layer is removed from list, and also verifies Delete multiple layers sequentially
- test_delete_layer_recreate - Delete and recreate layer with same name
- test_delete_layer_all_types - Delete layers with different presence types
B. Negative Scenarios (8 tests)
- test_delete_layer_non_existent - Delete layer that doesn't exist (404)
- test_delete_layer_empty_name - Delete with empty layer name
- test_delete_layer_null_name - Delete with null layer name
- test_delete_layer_invalid_name - Delete with invalid characters in name
- test_delete_layer_missing_name_param - Delete without name parameter
- test_delete_layer_with_active_experiments - Delete layer used in active experiments (should fail)
- test_delete_layer_twice - Delete same layer twice (second should fail)
- test_delete_layer_sql_injection - SQL injection attempt in layer name
C. Validation Scenarios (5 tests)
- test_delete_layer_cascading_effects - Verify experiments are updated after deletion - covered by delete layer with active experiment
- test_delete_layer_audit_trail - Verify deletion is logged - Not Suitable
- test_delete_layer_permissions - Test deletion with different permission levels - Needs auth
- test_delete_layer_soft_vs_hard_delete - Verify if deletion is soft or hard - covered by delete_layer_recreate
- test_delete_layer_rollback - Test rollback if deletion fails mid-process -- Complex scenario skipping
D. Integration Scenarios (4 tests)
- test_delete_layer_experiment_cleanup - Verify experiments handle deleted layers- Already covered by del_layer_active_Experiment
- test_delete_layer_detection_impact - Verify detection stops after deletion - complex for use case
- test_delete_layer_recommendations_impact - Check impact on existing recommendations -- integration tests not suitable for current suite
- test_delete_layer_concurrent_delete - Handle concurrent delete requests -- better as stress test
E. Edge Cases (3 tests)
- test_delete_layer_case_sensitivity - Test case-sensitive layer name deletion
- test_delete_layer_with_special_chars - Delete layer with special characters in name
- test_delete_layer_performance - Delete performance with many layers - skipped for functional test suite
Test Scenarios for UPDATE and DELETE Layer APIs
UPDATE LAYER API Test Scenarios
A. Positive Scenarios (8 tests)
B. Negative Scenarios (12 tests)
C. Validation Scenarios (6 tests)
D. Edge Cases (4 tests)
DELETE LAYER API Test Scenarios
A. Positive Scenarios (5 tests)
B. Negative Scenarios (8 tests)
C. Validation Scenarios (5 tests)
D. Integration Scenarios (4 tests)
E. Edge Cases (3 tests)