mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00

*feat: Update query-service Go version to 1.17 #911 *chore: Upgrade to clickhouse versions v2 #751 *feat: Duration sorting in events table of Trace-filter page #826 *feat: Add grpc status code to traces view #975 *feat: added filtering by resource attributes #881
30 lines
933 B
Go
30 lines
933 B
Go
package clickhouseReader
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
type GetStatusFiltersTest struct {
|
|
query string
|
|
statusParams []string
|
|
excludeMap map[string]struct{}
|
|
expected string
|
|
}
|
|
|
|
func TestGetStatusFilters(t *testing.T) {
|
|
assert := assert.New(t)
|
|
var tests = []GetStatusFiltersTest{
|
|
{"", make([]string, 0), map[string]struct{}{}, ""},
|
|
{"test", []string{"error"}, map[string]struct{}{}, "test AND hasError = true"},
|
|
{"test", []string{"ok"}, map[string]struct{}{}, "test AND hasError = false"},
|
|
{"test", []string{"error"}, map[string]struct{}{"status": {}}, "test AND hasError = false"},
|
|
{"test", []string{"ok"}, map[string]struct{}{"status": {}}, "test AND hasError = true"},
|
|
{"test", []string{"error", "ok"}, map[string]struct{}{}, "test"},
|
|
}
|
|
for _, test := range tests {
|
|
assert.Equal(getStatusFilters(test.query, test.statusParams, test.excludeMap), test.expected)
|
|
}
|
|
}
|