shared helper init function for starting the metadata storage

This commit is contained in:
A.Unger
2020-10-08 10:21:18 +02:00
committed by Ilja Neumann
parent 7d999f1334
commit 3a08a6eac0
2 changed files with 23 additions and 27 deletions

View File

@@ -1,38 +1,17 @@
package cs3
import (
"context"
"flag"
"os"
"path"
"testing"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/indexer/option"
. "github.com/owncloud/ocis/accounts/pkg/indexer/test"
"github.com/owncloud/ocis/storage/pkg/command"
mcfg "github.com/owncloud/ocis/storage/pkg/config"
"github.com/stretchr/testify/assert"
)
func init() {
go setupMetadataStorage()
}
func setupMetadataStorage() {
cfg := mcfg.New()
app := cli.App{
Name: "storage-metadata-for-tests",
Commands: []*cli.Command{command.StorageMetadata(cfg)},
}
_ = app.Command("storage-metadata").Run(cli.NewContext(&app, &flag.FlagSet{}, &cli.Context{Context: context.Background()}))
}
func TestCS3UniqueIndex_FakeSymlink(t *testing.T) {
//go setupMetadataStorage()
dataDir := WriteIndexTestDataCS3(t,Data, "Id")
cfg := config.Config{
Repo: config.Repo{
@@ -79,13 +58,9 @@ func TestCS3UniqueIndex_FakeSymlink(t *testing.T) {
assert.Equal(t, searchRes[0], "abcdefg-123")
_ = os.RemoveAll(dataDir)
//cancelFunc()
}
func TestCS3UniqueIndexSearch(t *testing.T) {
//go setupMetadataStorage()
dataDir := WriteIndexTestDataCS3(t, Data, "Id")
cfg := config.Config{
Repo: config.Repo{
@@ -126,6 +101,4 @@ func TestCS3UniqueIndexSearch(t *testing.T) {
t.Log(res)
_ = os.RemoveAll(dataDir)
//cancelFunc()
}

View File

@@ -0,0 +1,23 @@
package test
import (
"context"
"flag"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/command"
mcfg "github.com/owncloud/ocis/storage/pkg/config"
)
func init() {
go setupMetadataStorage()
}
func setupMetadataStorage() {
cfg := mcfg.New()
app := cli.App{
Name: "storage-metadata-for-tests",
Commands: []*cli.Command{command.StorageMetadata(cfg)},
}
_ = app.Command("storage-metadata").Run(cli.NewContext(&app, &flag.FlagSet{}, &cli.Context{Context: context.Background()}))
}