improve testing

This commit is contained in:
pb 2024-07-17 17:19:42 +02:00
parent 4fd22dc131
commit 90e9bcf378
3 changed files with 47 additions and 0 deletions

46
mongo/mongo_utils.go Normal file
View File

@ -0,0 +1,46 @@
package mongo
import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
)
// Will store the created collection object for a faster access
var CollectionMap map[string]*mongo.Collection
var IndexesMap map[string][]mongo.IndexModel
func init() {
CollectionMap = make(map[string]*mongo.Collection)
IndexesMap = make(map[string][]mongo.IndexModel)
IndexesMap["data"] = append(IndexesMap["data"], mongo.IndexModel{Keys: bson.D{
{Key: "description", Value:"text"},
{Key: "example", Value:"text"}},
})
IndexesMap["datacenter"] = append(IndexesMap["datacenter"], mongo.IndexModel{Keys: bson.D{
{Key: "description", Value:"text"},
{Key: "example", Value:"text"},
{Key: "owner", Value:"text"}},
})
IndexesMap["storage"] = append(IndexesMap["storage"], mongo.IndexModel{Keys: bson.D{
{Key: "description", Value:"text"},
{Key: "example", Value:"text"}},
})
IndexesMap["processing"] = append(IndexesMap["processing"], mongo.IndexModel{Keys: bson.D{
{Key: "description", Value:"text"},
{Key: "example", Value:"text"},
{Key: "owner", Value:"text"},
},
})
IndexesMap["workflow"] = append(IndexesMap["workflow"], mongo.IndexModel{Keys: bson.D{
{Key: "description", Value:"text"},
{Key: "example", Value:"text"},
{Key: "owner", Value:"text"},
},
})
}

1
tests/config.go Normal file
View File

@ -0,0 +1 @@
package tests