diff --git a/pkg/database/database_race_test.go b/pkg/database/database_race_test.go index 35c8b9e..9372f18 100644 --- a/pkg/database/database_race_test.go +++ b/pkg/database/database_race_test.go @@ -31,7 +31,7 @@ func setupRaceTestDB(t *testing.T) func() { } // 10 goroutines × 100 inserts each → no race detector warnings -func TestConcurrentHashrateInserts(t *testing.T) { +func TestDatabaseRace_ConcurrentHashrateInserts_Ugly(t *testing.T) { cleanup := setupRaceTestDB(t) defer cleanup() @@ -74,7 +74,7 @@ func TestConcurrentHashrateInserts(t *testing.T) { } // 1 writer + 5 readers concurrently → no race detector warnings -func TestConcurrentInsertAndQuery(t *testing.T) { +func TestDatabaseRace_ConcurrentInsertAndQuery_Ugly(t *testing.T) { cleanup := setupRaceTestDB(t) defer cleanup() @@ -126,7 +126,7 @@ func TestConcurrentInsertAndQuery(t *testing.T) { } // inserts (old + new data) + periodic Cleanup(7) → no race detector warnings -func TestConcurrentInsertAndCleanup(t *testing.T) { +func TestDatabaseRace_ConcurrentInsertAndCleanup_Ugly(t *testing.T) { cleanup := setupRaceTestDB(t) defer cleanup() @@ -183,7 +183,7 @@ func TestConcurrentInsertAndCleanup(t *testing.T) { } // 20 goroutines × 50 GetHashrateStats calls → no race detector warnings -func TestConcurrentStats(t *testing.T) { +func TestDatabaseRace_ConcurrentStats_Ugly(t *testing.T) { cleanup := setupRaceTestDB(t) defer cleanup() @@ -222,7 +222,7 @@ func TestConcurrentStats(t *testing.T) { } // 10 readers + 1 writer concurrently on GetAllMinerStats → no race detector warnings -func TestConcurrentGetAllStats(t *testing.T) { +func TestDatabaseRace_ConcurrentGetAllStats_Ugly(t *testing.T) { cleanup := setupRaceTestDB(t) defer cleanup() diff --git a/pkg/database/interface_test.go b/pkg/database/interface_test.go index 2d62cef..03aff83 100644 --- a/pkg/database/interface_test.go +++ b/pkg/database/interface_test.go @@ -6,7 +6,7 @@ import ( "time" ) -func TestDefaultStore(t *testing.T) { +func TestInterface_DefaultStore_Good(t *testing.T) { cleanup := setupTestDB(t) defer cleanup() @@ -81,7 +81,7 @@ func TestDefaultStore_WithContext(t *testing.T) { } } -func TestNopStore(t *testing.T) { +func TestInterface_NopStore_Good(t *testing.T) { store := NopStore() // All operations should succeed without error diff --git a/pkg/mining/manager_race_test.go b/pkg/mining/manager_race_test.go index 6b0e830..ae57d90 100644 --- a/pkg/mining/manager_race_test.go +++ b/pkg/mining/manager_race_test.go @@ -9,7 +9,7 @@ import ( // TestConcurrentStartMultipleMiners verifies that concurrent StartMiner calls // with different algorithms create unique miners without race conditions -func TestConcurrentStartMultipleMiners(t *testing.T) { +func TestManagerRace_ConcurrentStartMultipleMiners_Ugly(t *testing.T) { m := setupTestManager(t) defer m.Stop() @@ -52,7 +52,7 @@ func TestConcurrentStartMultipleMiners(t *testing.T) { // TestConcurrentStartDuplicateMiner verifies that starting the same miner // concurrently results in only one success -func TestConcurrentStartDuplicateMiner(t *testing.T) { +func TestManagerRace_ConcurrentStartDuplicateMiner_Ugly(t *testing.T) { m := setupTestManager(t) defer m.Stop() @@ -97,7 +97,7 @@ func TestConcurrentStartDuplicateMiner(t *testing.T) { // TestConcurrentStartStop verifies that starting and stopping miners // concurrently doesn't cause race conditions -func TestConcurrentStartStop(t *testing.T) { +func TestManagerRace_ConcurrentStartStop_Ugly(t *testing.T) { m := setupTestManager(t) defer m.Stop() @@ -151,7 +151,7 @@ func TestConcurrentStartStop(t *testing.T) { // TestConcurrentListMiners verifies that listing miners while modifying // the miner map doesn't cause race conditions -func TestConcurrentListMiners(t *testing.T) { +func TestManagerRace_ConcurrentListMiners_Ugly(t *testing.T) { m := setupTestManager(t) defer m.Stop() @@ -202,7 +202,7 @@ func TestConcurrentListMiners(t *testing.T) { // TestConcurrentGetMiner verifies that getting a miner while others // are being started/stopped doesn't cause race conditions -func TestConcurrentGetMiner(t *testing.T) { +func TestManagerRace_ConcurrentGetMiner_Ugly(t *testing.T) { m := setupTestManager(t) defer m.Stop() @@ -267,7 +267,7 @@ func TestConcurrentGetMiner(t *testing.T) { // TestConcurrentStatsCollection verifies that stats collection // doesn't race with miner operations -func TestConcurrentStatsCollection(t *testing.T) { +func TestManagerRace_ConcurrentStatsCollection_Ugly(t *testing.T) { m := setupTestManager(t) defer m.Stop() diff --git a/pkg/mining/service_test.go b/pkg/mining/service_test.go index c58016c..bc6c0bb 100644 --- a/pkg/mining/service_test.go +++ b/pkg/mining/service_test.go @@ -228,7 +228,7 @@ func TestService_HandleGetMinerHashrateHistory_Good(t *testing.T) { } } -func TestGenerateRequestID_FormatAndUniqueness(t *testing.T) { +func TestService_GenerateRequestID_Good(t *testing.T) { firstRequestID := generateRequestID() secondRequestID := generateRequestID() @@ -247,7 +247,7 @@ func TestGenerateRequestID_FormatAndUniqueness(t *testing.T) { } } -func TestRequestIDMiddleware_PreservesProvidedHeader(t *testing.T) { +func TestService_RequestIDMiddleware_Good(t *testing.T) { gin.SetMode(gin.TestMode) router := gin.New() router.Use(requestIDMiddleware()) diff --git a/pkg/mining/stats_collector_test.go b/pkg/mining/stats_collector_test.go index dc597ab..a6a5152 100644 --- a/pkg/mining/stats_collector_test.go +++ b/pkg/mining/stats_collector_test.go @@ -10,7 +10,7 @@ import ( "time" ) -func TestFetchJSONStats(t *testing.T) { +func TestStatsCollector_FetchJSONStats_Good(t *testing.T) { t.Run("SuccessfulFetch", func(t *testing.T) { // Create a test server server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -85,7 +85,7 @@ func TestFetchJSONStats(t *testing.T) { }) } -func TestMinerTypeRegistry(t *testing.T) { +func TestStatsCollector_MinerTypeRegistry_Good(t *testing.T) { t.Run("KnownTypes", func(t *testing.T) { if !IsMinerSupported(MinerTypeXMRig) { t.Error("xmrig should be a known miner type") @@ -112,7 +112,7 @@ func TestMinerTypeRegistry(t *testing.T) { }) } -func TestGetType(t *testing.T) { +func TestStatsCollector_GetType_Good(t *testing.T) { t.Run("XMRigMiner", func(t *testing.T) { miner := NewXMRigMiner() if miner.GetType() != MinerTypeXMRig { diff --git a/pkg/mining/throttle_test.go b/pkg/mining/throttle_test.go index e068cdd..b4c5b43 100644 --- a/pkg/mining/throttle_test.go +++ b/pkg/mining/throttle_test.go @@ -11,7 +11,7 @@ import ( ) // TestCPUThrottleSingleMiner tests that a single miner respects CPU throttle settings -func TestCPUThrottleSingleMiner(t *testing.T) { +func TestThrottle_CPUThrottleSingleMiner_Good(t *testing.T) { if testing.Short() { t.Skip("Skipping CPU throttle test in short mode") } @@ -57,7 +57,7 @@ func TestCPUThrottleSingleMiner(t *testing.T) { } // TestCPUThrottleDualMiners tests that two miners together respect combined CPU limits -func TestCPUThrottleDualMiners(t *testing.T) { +func TestThrottle_CPUThrottleDualMiners_Good(t *testing.T) { if testing.Short() { t.Skip("Skipping CPU throttle test in short mode") } @@ -125,7 +125,7 @@ func TestCPUThrottleDualMiners(t *testing.T) { } // TestCPUThrottleThreadCount tests thread-based CPU limiting -func TestCPUThrottleThreadCount(t *testing.T) { +func TestThrottle_CPUThrottleThreadCount_Good(t *testing.T) { if testing.Short() { t.Skip("Skipping CPU throttle test in short mode") } @@ -173,7 +173,7 @@ func TestCPUThrottleThreadCount(t *testing.T) { } // TestMinerResourceIsolation tests that miners don't interfere with each other -func TestMinerResourceIsolation(t *testing.T) { +func TestThrottle_MinerResourceIsolation_Good(t *testing.T) { if testing.Short() { t.Skip("Skipping resource isolation test in short mode") } diff --git a/pkg/mining/xmrig_gpu_test.go b/pkg/mining/xmrig_gpu_test.go index a158b11..401d2da 100644 --- a/pkg/mining/xmrig_gpu_test.go +++ b/pkg/mining/xmrig_gpu_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -func TestXMRigDualMiningConfig(t *testing.T) { +func TestXmrigGpu_DualMiningConfig_Good(t *testing.T) { // Create a temp directory for the config tmpDir := t.TempDir() @@ -120,7 +120,7 @@ func TestXMRigDualMiningConfig(t *testing.T) { t.Logf("Generated dual-mining config:\n%s", string(data)) } -func TestXMRigGPUOnlyConfig(t *testing.T) { +func TestXmrigGpu_GPUOnlyConfig_Good(t *testing.T) { tmpDir := t.TempDir() miner := &XMRigMiner{ @@ -180,7 +180,7 @@ func TestXMRigGPUOnlyConfig(t *testing.T) { t.Logf("Generated GPU config:\n%s", string(data)) } -func TestXMRigCPUOnlyConfig(t *testing.T) { +func TestXmrigGpu_CPUOnlyConfig_Good(t *testing.T) { tmpDir := t.TempDir() miner := &XMRigMiner{ diff --git a/pkg/mining/xmrig_test.go b/pkg/mining/xmrig_test.go index 3097481..3a6ac81 100644 --- a/pkg/mining/xmrig_test.go +++ b/pkg/mining/xmrig_test.go @@ -117,7 +117,7 @@ func TestXMRigMiner_Start_Stop_Bad(t *testing.T) { t.Skip("Skipping test that attempts to spawn miner process") } -func TestXMRigMiner_CheckInstallation(t *testing.T) { +func TestXMRigMiner_CheckInstallation_Good(t *testing.T) { tmpDir := t.TempDir() // Use "miner" since that's what NewXMRigMiner() sets as ExecutableName executableName := "miner"