mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-09-13 22:29:01 -04:00
both engines now agree on names, titles, tags, paths, types, sizes, dates, hidden flags, facet values and wildcards. quotes only delimit phrases and the equals operator matches the whole field value, following the kql spec. the index name carries a generation so a changed mapping starts on a fresh index, MIGRATION.md says how to fill it.
41 lines
745 B
Go
41 lines
745 B
Go
package opensearchtest
|
|
|
|
import (
|
|
"embed"
|
|
"encoding/json"
|
|
"fmt"
|
|
"path"
|
|
|
|
"github.com/opencloud-eu/opencloud/services/search/pkg/search"
|
|
)
|
|
|
|
//go:embed testdata/*.json
|
|
var testdata embed.FS
|
|
|
|
var Testdata = struct {
|
|
Resources resourceTestdata
|
|
}{
|
|
Resources: resourceTestdata{
|
|
File: fromTestData[search.Resource]("resource_file.json"),
|
|
},
|
|
}
|
|
|
|
type resourceTestdata struct {
|
|
File search.Resource
|
|
}
|
|
|
|
func fromTestData[D any](name string) D {
|
|
name = path.Join("./testdata", name)
|
|
data, err := testdata.ReadFile(name)
|
|
if err != nil {
|
|
panic(fmt.Sprintf("failed to read testdata file %s: %v", name, err))
|
|
}
|
|
|
|
var d D
|
|
if json.Unmarshal(data, &d) != nil {
|
|
panic(fmt.Sprintf("failed to unmarshal testdata %s: %v", name, err))
|
|
}
|
|
|
|
return d
|
|
}
|