mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-23 05:59:28 -06:00
shared helper init function for starting the metadata storage
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
23
accounts/pkg/indexer/test/test.go
Normal file
23
accounts/pkg/indexer/test/test.go
Normal 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()}))
|
||||
}
|
||||
Reference in New Issue
Block a user