setupTestEnvironment sets up test environment
()
| 99 | |
| 100 | // setupTestEnvironment sets up test environment |
| 101 | func setupTestEnvironment() { |
| 102 | // Initialize only once |
| 103 | if testPlugin != nil { |
| 104 | return |
| 105 | } |
| 106 | |
| 107 | // Create and register test plugin |
| 108 | testPlugin = &TestKVStoragePlugin{} |
| 109 | plugin.Register(testPlugin) |
| 110 | |
| 111 | // Enable plugin |
| 112 | plugin.StatusManager.Enable("test_kv_storage", true) |
| 113 | |
| 114 | // Initialize plugin data, refer to plugin_common_service.go implementation |
| 115 | _ = plugin.CallKVStorage(func(k plugin.KVStorage) error { |
| 116 | k.SetOperator(plugin.NewKVOperator( |
| 117 | testDataSource.DB, |
| 118 | testDataSource.Cache, |
| 119 | k.Info().SlugName, |
| 120 | )) |
| 121 | return nil |
| 122 | }) |
| 123 | } |
| 124 | |
| 125 | // Test basic operations including CRUD and edge cases |
| 126 | func TestBasicOperations(t *testing.T) { |
no test coverage detected