Skip to content

Instantly share code, notes, and snippets.

@PatrickLang
Created February 21, 2019 23:40
Show Gist options
  • Save PatrickLang/ceac90d38795385a2fc5b8688ba1323b to your computer and use it in GitHub Desktop.
Save PatrickLang/ceac90d38795385a2fc5b8688ba1323b to your computer and use it in GitHub Desktop.
Time spent in failed Kubernetes test cases
curl.exe https://storage.googleapis.com/kubernetes-jenkins/logs/ci-kubernetes-e2e-aks-engine-azure-master-windows/2/build-log.txt -o build-log-2.txt
$lines = Select-String -Pattern "Failure \[(?<time>\d+\.\d+)"  -Path .\build-log-2.txt
($lines | %{$_.Matches[0].Groups["time"].Value} | Measure-Object -Sum).Sum / 60 ; "minutes spent in failed test cases"

Returns

237.2573
minutes spent in failed test cases
@PatrickLang
Copy link
Author

In a more successful test pass:

$lines = Select-String -Pattern "Failure [(?\d+.\d+)" -Path .\build-log-1.txt
PS C:\Users\plang> ($lines | %{$_.Matches[0].Groups["time"].Value} | Measure-Object -Sum).Sum / 60 ; "minutes spent in failed test cases"
13.13025
minutes spent in failed test cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment