- Add logs and debug end-to-end tests - Add test helper utilities - Improve test fixtures and templates - Update API server and config lint commands - Add multi-user database initialization
40 lines
738 B
Go
40 lines
738 B
Go
package benchmarks
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/jfraeys/fetch_ml/internal/queue"
|
|
)
|
|
|
|
// BenchmarkNativeQueueBasic tests basic native queue operations
|
|
func BenchmarkNativeQueueBasic(b *testing.B) {
|
|
tmpDir := b.TempDir()
|
|
|
|
// Only run if native libs available
|
|
if !queue.UseNativeQueue {
|
|
b.Skip("Native queue not enabled (set FETCHML_NATIVE_LIBS=1)")
|
|
}
|
|
|
|
q, err := queue.NewNativeQueue(tmpDir)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
defer q.Close()
|
|
|
|
// Test single add
|
|
task := &queue.Task{
|
|
ID: "test-1",
|
|
JobName: "test-job",
|
|
Priority: 100,
|
|
}
|
|
|
|
b.ResetTimer()
|
|
b.ReportAllocs()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
task.ID = "test-" + string(rune('0'+i%10))
|
|
if err := q.AddTask(task); err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|