Add backup and restore test (#1)

* Add backup and restore test
* Update arango binaries
This commit is contained in:
Jonas Plum
2021-12-24 00:22:08 +01:00
committed by GitHub
parent c27e61b875
commit 0286574692
9 changed files with 336 additions and 27 deletions

View File

@@ -36,7 +36,8 @@ func Context() context.Context {
func Config(ctx context.Context) (*catalyst.Config, error) {
config := &catalyst.Config{
IndexPath: "index.bleve",
InitialAPIKey: "test",
IndexPath: "index.bleve",
DB: &database.Config{
Host: "http://localhost:8529",
User: "root",
@@ -147,8 +148,8 @@ func DB(t *testing.T) (context.Context, *catalyst.Config, *bus.Bus, *index.Index
_, err = db.JobCreate(ctx, "99cd67131b48", &models.JobForm{
Automation: "hash.sha1",
Payload: "test",
Origin: nil,
Payload: "test",
Origin: nil,
})
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, err
@@ -188,6 +189,21 @@ func Server(t *testing.T) (context.Context, *catalyst.Config, *bus.Bus, *index.I
return ctx, config, rbus, catalystIndex, catalystStorage, db, catalystService, catalystServer, cleanup, err
}
func Catalyst(t *testing.T) (context.Context, *catalyst.Config, *catalyst.Server, error) {
ctx := Context()
config, err := Config(ctx)
if err != nil {
t.Fatal(err)
}
config.DB.Name = cleanName(t)
c, err := catalyst.New(&hooks.Hooks{
DatabaseAfterConnectFuncs: []func(ctx context.Context, client driver.Client, name string){Clear},
}, config)
return ctx, config, c, err
}
func cleanName(t *testing.T) string {
name := t.Name()
name = strings.ReplaceAll(name, " ", "")