mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
28 lines
809 B
Go
28 lines
809 B
Go
|
package logstorage
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestPipeFieldNamesUpdateNeededFields(t *testing.T) {
|
||
|
f := func(s string, neededFields, unneededFields, neededFieldsExpected, unneededFieldsExpected string) {
|
||
|
t.Helper()
|
||
|
expectPipeNeededFields(t, s, neededFields, unneededFields, neededFieldsExpected, unneededFieldsExpected)
|
||
|
}
|
||
|
|
||
|
// all the needed fields
|
||
|
f("field_names as f1", "*", "", "*", "")
|
||
|
|
||
|
// all the needed fields, unneeded fields do not intersect with src
|
||
|
f("field_names as f3", "*", "f1,f2", "*", "")
|
||
|
|
||
|
// all the needed fields, unneeded fields intersect with src
|
||
|
f("field_names as f1", "*", "s1,f1,f2", "*", "")
|
||
|
|
||
|
// needed fields do not intersect with src
|
||
|
f("field_names as f3", "f1,f2", "", "*", "")
|
||
|
|
||
|
// needed fields intersect with src
|
||
|
f("field_names as f1", "s1,f1,f2", "", "*", "")
|
||
|
}
|