ax(batch): apply Good/Bad/Ugly test naming to remaining test files
Second pass of test naming convention across xmrig_test.go, xmrig_gpu_test.go, stats_collector_test.go, manager_race_test.go, throttle_test.go, service_test.go, interface_test.go, database_race_test.go. 30 additional tests renamed. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
a7b7d6a2aa
commit
c67dca2a97
8 changed files with 26 additions and 26 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue