diff --git a/tests/fields.go b/tests/fields.go index d6fc40a9644..65bb3f942db 100644 --- a/tests/fields.go +++ b/tests/fields.go @@ -28,6 +28,7 @@ import ( "github.com/elastic/apm-server/tests/loader" "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/mapping" ) // This test checks @@ -191,7 +192,7 @@ func fetchFlattenedFieldNames(paths []string, filters ...filter) (*Set, error) { return fields, nil } -func flattenFieldNames(fields []common.Field, prefix string, flattened *Set, filters ...filter) { +func flattenFieldNames(fields []mapping.Field, prefix string, flattened *Set, filters ...filter) { for _, f := range fields { key := strConcat(prefix, f.Name, ".") add := true @@ -205,8 +206,8 @@ func flattenFieldNames(fields []common.Field, prefix string, flattened *Set, fil } } -func loadFields(yamlPath string) ([]common.Field, error) { - fields := []common.Field{} +func loadFields(yamlPath string) ([]mapping.Field, error) { + fields := []mapping.Field{} yaml, err := ioutil.ReadFile(yamlPath) if err != nil { @@ -224,16 +225,16 @@ func loadFields(yamlPath string) ([]common.Field, error) { } // false to exclude field -type filter func(common.Field) bool +type filter func(mapping.Field) bool -func hasName(f common.Field) bool { +func hasName(f mapping.Field) bool { return f.Name != "" } -func isEnabled(f common.Field) bool { +func isEnabled(f mapping.Field) bool { return f.Enabled == nil || *f.Enabled } -func isDisabled(f common.Field) bool { +func isDisabled(f mapping.Field) bool { return f.Enabled != nil && !*f.Enabled } diff --git a/tests/json_schema.go b/tests/json_schema.go index 43610a1d0ae..e2d56c885c7 100644 --- a/tests/json_schema.go +++ b/tests/json_schema.go @@ -29,7 +29,7 @@ import ( "github.com/stretchr/testify/require" "github.com/elastic/beats/libbeat/beat" - "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/mapping" ) type TestProcessor interface { @@ -187,7 +187,7 @@ func (ps *ProcessorSetup) KeywordLimitation(t *testing.T, keywordExceptionKeys * // fetch keyword restricted field names from ES template keywordFields, err := fetchFlattenedFieldNames(ps.TemplatePaths, hasName, - func(f common.Field) bool { return f.Type == "keyword" }) + func(f mapping.Field) bool { return f.Type == "keyword" }) require.NoError(t, err) // fetch length restricted field names from json schema