Skip to content

Commit

Permalink
init velero analyzer tests
Browse files Browse the repository at this point in the history
Signed-off-by: Archit Sharma <[email protected]>
  • Loading branch information
arcolife committed Oct 31, 2023
1 parent b006fcd commit 7a2a80a
Show file tree
Hide file tree
Showing 2 changed files with 1,014 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/analyze/velero.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (a *AnalyzeVelero) veleroStatus(analyzer *troubleshootv1beta2.VeleroAnalyze
results = append(results, analyzePodVolumeRestores(podVolumeRestores)...)
results = append(results, analyzeRestores(restores)...)
results = append(results, analyzeSchedules(schedules)...)
results = append(results, analyzeServerStatusRequests(serverStatusRequests)...)
// results = append(results, analyzeServerStatusRequests(serverStatusRequests)...)
results = append(results, analyzeVolumeSnapshotLocations(volumeSnapshotLocations)...)

return aggregateResults(results), nil
Expand Down Expand Up @@ -558,11 +558,11 @@ func analyzeSchedules(schedules []*velerov1.Schedule) []*AnalyzeResult {
return results
}

func analyzeServerStatusRequests(serverStatusRequests []*velerov1.ServerStatusRequest) []*AnalyzeResult {
results := []*AnalyzeResult{}
// TODO
return results
}
// func analyzeServerStatusRequests(serverStatusRequests []*velerov1.ServerStatusRequest) []*AnalyzeResult {
// results := []*AnalyzeResult{}

// return results
// }

func analyzeVolumeSnapshotLocations(volumeSnapshotLocations []*velerov1.VolumeSnapshotLocation) []*AnalyzeResult {
results := []*AnalyzeResult{}
Expand Down Expand Up @@ -598,24 +598,24 @@ func analyzeLogs(logs map[string][]byte) []*AnalyzeResult {
for _, logBytes := range logs {
logContent := string(logBytes)
result := &AnalyzeResult{
Title: fmt.Sprintf("Velero logs for pod [node-agent] "),
Title: fmt.Sprintf("Velero logs for pod [node-agent]"),
}
if strings.Contains(logContent, "permission denied") {
result.IsFail = true
result.Message = fmt.Sprintf("Found 'permission denied' in node-agent log file(s)")
result.Message = fmt.Sprintf("Found 'permission denied' in node-agent* pod log file(s)")
results = append(results, result)
continue
}

if strings.Contains(logContent, "error") || strings.Contains(logContent, "panic") || strings.Contains(logContent, "fatal") {
result.IsWarn = true
result.Message = fmt.Sprintf("Found error|panic|fatal in node-agent log file(s)")
result.Message = fmt.Sprintf("Found error|panic|fatal in node-agent* pod log file(s)")
results = append(results, result)
}
}

results = append(results, &AnalyzeResult{
Title: "Velero Logs",
Title: "Velero Logs analysis",
IsPass: true,
Message: fmt.Sprintf("Found %d log files", len(logs)),
})
Expand Down
Loading

0 comments on commit 7a2a80a

Please sign in to comment.