Files
karma/internal/alertmanager/benchmark_test.go
Łukasz Mierzwa 5d4ae47888 Convert all packages to be internal
Internal packages are supported by Go 1.5+, any package in /internal/ dir is only importable from the same repo. This will cleanup main dir a bit and provide better namespace for unsee subpackages
2017-08-04 16:21:27 -07:00

40 lines
797 B
Go

package alertmanager_test
import (
"os"
"testing"
"github.com/cloudflare/unsee/internal/alertmanager"
"github.com/cloudflare/unsee/internal/config"
)
func BenchmarkDedupAlerts(b *testing.B) {
if err := pullAlerts(); err != nil {
b.Error(err)
}
for n := 0; n < b.N; n++ {
alertmanager.DedupAlerts()
}
}
func BenchmarkDedupAutocomplete(b *testing.B) {
if err := pullAlerts(); err != nil {
b.Error(err)
}
for n := 0; n < b.N; n++ {
alertmanager.DedupAutocomplete()
}
}
func BenchmarkDedupColors(b *testing.B) {
os.Setenv("COLOR_LABELS_UNIQUE", "cluster instance @receiver")
os.Setenv("ALERTMANAGER_URIS", "default:http://localhost")
config.Config.Read()
if err := pullAlerts(); err != nil {
b.Error(err)
}
for n := 0; n < b.N; n++ {
alertmanager.DedupColors()
}
}