Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

feat(ai): enhance AI Patrol with baseline anomaly detection and correlation learning

rcourtman83935fa871e7
diff --git a/internal/ai/providers/integration_test.go b/internal/ai/providers/integration_test.go
index 667082fb12..9e01b3cc2c 100644
--- a/internal/ai/providers/integration_test.go
+++ b/internal/ai/providers/integration_test.go
@@ -1,3 +1,4 @@
+//go:build integration
// +build integration
package providers_test
@@ -27,7 +28,7 @@ func getOllamaURL() string {
}
func TestIntegration_Ollama_TestConnection(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
@@ -40,7 +41,7 @@ func TestIntegration_Ollama_TestConnection(t *testing.T) {
}
func TestIntegration_Ollama_ListModels(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
@@ -61,7 +62,7 @@ func TestIntegration_Ollama_ListModels(t *testing.T) {
}
func TestIntegration_Ollama_SimpleChat(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
@@ -86,7 +87,7 @@ func TestIntegration_Ollama_SimpleChat(t *testing.T) {
}
func TestIntegration_Ollama_SystemPrompt(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
@@ -116,7 +117,7 @@ func TestIntegration_Ollama_SystemPrompt(t *testing.T) {
}
func TestIntegration_Ollama_MultiTurnConversation(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()
@@ -155,7 +156,7 @@ func TestIntegration_Ollama_MultiTurnConversation(t *testing.T) {
}
func TestIntegration_Ollama_TokenCounting(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
@@ -183,7 +184,7 @@ func TestIntegration_Ollama_TokenCounting(t *testing.T) {
}
func TestIntegration_Ollama_ErrorHandling_BadModel(t *testing.T) {
- client := providers.NewOllamaClient("nonexistent-model-12345", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("nonexistent-model-12345", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
@@ -202,7 +203,7 @@ func TestIntegration_Ollama_ErrorHandling_BadModel(t *testing.T) {
}
func TestIntegration_Ollama_Timeout(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
// Very short timeout - should fail
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond)
@@ -225,7 +226,7 @@ func TestIntegration_Ollama_Timeout(t *testing.T) {
// --- More useful tests below ---
func TestIntegration_Ollama_JSONOutput(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
@@ -267,7 +268,7 @@ func TestIntegration_Ollama_JSONOutput(t *testing.T) {
}
func TestIntegration_Ollama_LongResponse(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()
@@ -292,7 +293,7 @@ func TestIntegration_Ollama_LongResponse(t *testing.T) {
}
func TestIntegration_Ollama_EmptyMessage(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
@@ -313,7 +314,7 @@ func TestIntegration_Ollama_EmptyMessage(t *testing.T) {
}
func TestIntegration_Ollama_SpecialCharacters(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
@@ -336,7 +337,7 @@ func TestIntegration_Ollama_SpecialCharacters(t *testing.T) {
}
func TestIntegration_Ollama_ConcurrentRequests(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
const numRequests = 3
results := make(chan error, numRequests)
@@ -372,7 +373,7 @@ func TestIntegration_Ollama_ConcurrentRequests(t *testing.T) {
func TestIntegration_Ollama_InfrastructureAnalysis(t *testing.T) {
// This simulates what Pulse actually does - send infrastructure context
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
defer cancel()
@@ -416,7 +417,7 @@ What should I investigate first?`
}
func TestIntegration_Ollama_ModelName_Preserved(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
@@ -441,7 +442,7 @@ func TestIntegration_Ollama_ModelName_Preserved(t *testing.T) {
}
func TestIntegration_Ollama_StopReason(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
@@ -461,7 +462,7 @@ func TestIntegration_Ollama_StopReason(t *testing.T) {
}
func TestIntegration_Ollama_VeryLongInput(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()
@@ -486,7 +487,7 @@ func TestIntegration_Ollama_VeryLongInput(t *testing.T) {
}
func TestIntegration_Ollama_RapidFireRequests(t *testing.T) {
- client := providers.NewOllamaClient("tinyllama", getOllamaURL(, 0))
+ client := providers.NewOllamaClient("tinyllama", getOllamaURL())
// Send 5 requests in rapid succession
for i := 0; i < 5; i++ {