MCPcopy
hub / github.com/apache/answer / setupTestEnvironment

Function setupTestEnvironment

plugin/plugin_test/kv_storage_test.go:101–123  ·  view source on GitHub ↗

setupTestEnvironment sets up test environment

()

Source from the content-addressed store, hash-verified

99
100// setupTestEnvironment sets up test environment
101func 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
126func TestBasicOperations(t *testing.T) {

Callers 4

TestBasicOperationsFunction · 0.85
TestTransactionsFunction · 0.85
TestPaginationFunction · 0.85
TestConcurrencyFunction · 0.85

Calls 5

RegisterFunction · 0.92
NewKVOperatorFunction · 0.92
EnableMethod · 0.80
SetOperatorMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected