Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add run cases #61

Merged
merged 2 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ cd build
./storage_provider -v
# Run Services
./storage_provider -config ./config.toml
# Run Cases
./test-storage-provider
```
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ go build -ldflags "\
-X 'main.BuildTime=${BuildTime}'" \
-o storage_provider cmd/storage_provider/*.go

go build -o test-storage-provider test/e2e/services/case_driver.go

if [ ! -d build ];then
mkdir build
mkdir -p build/data
fi
mv storage_provider ./build
mv test-storage-provider ./build
cp config/config.toml ./build
206 changes: 96 additions & 110 deletions config/config.toml
Original file line number Diff line number Diff line change
@@ -1,125 +1,111 @@
Service = [
"StoneHub", "Gateway", "Uploader", "StoneNode", "Syncer", "Downloader",
"Gateway", "Uploader", "Downloader", "StoneHub", "StoneNode", "Syncer",
]

[StoneHubCfg]
StorageProvider = "bnb-sp"
Address = "127.0.0.1:5323"
JobDBType = "memory"
MetaDBType = "leveldb"
[StoneHubCfg.JobDB]
User = "root"
Passwd = "bfs-test"
Address = "127.0.0.1:3306"
Database = "job_context"


[GatewayCfg]
Address = "127.0.0.1:5310"
Domain = "bfs.nodereal.com"
[GatewayCfg.UploaderConfig]
#Mode = "DebugMode"
Mode = "GrpcMode"
DebugDir = "./debug"
Address = "127.0.0.1:5311"
[GatewayCfg.ChainConfig]
Mode = "DebugMode"
DebugDir = "./debug"
[GatewayCfg.DownloaderConfig]
Mode = "DebugMode"
DebugDir = "./debug"
Address = "127.0.0.1:5523"
Address = "127.0.0.1:9033"
Domain = "bfs.nodereal.com"
[GatewayCfg.UploaderConfig]
Mode = "GrpcMode"
DebugDir = "./data/debug"
Address = "127.0.0.1:9133"
[GatewayCfg.ChainConfig]
Mode = "DebugMode"
DebugDir = "./data/debug"
[GatewayCfg.DownloaderConfig]
Mode = "GrpcMode"
DebugDir = "./data/debug"
Address = "127.0.0.1:9233"

[UploaderCfg]
StorageProvider = "bnb-sp"
Address = "127.0.0.1:9133"
StoneHubServiceAddress = "127.0.0.1:9333"
[UploaderCfg.PieceStoreConfig]
Shards = 0
[UploaderCfg.PieceStoreConfig.Store]
Storage = "file"
BucketURL = "./data/primary_payload_data"
MaxRetries = 5
TestMode = true
#AccessKey = "ACCESSKEY"
#SecretKey = "SECRETKEY"
#SessionToken = "SESSIONTOKEN"
#NoSignRequest = false
#TlsInsecureSkipVerify = false
[UploaderCfg.MetaDBConfig]
Path = "./data/meta"
NameSpace = "bnb-sp"
Cache = 4096
FileHandles = 1000
ReadOnly = false

[DownloaderCfg]
Address = "127.0.0.1:9233"
[DownloaderCfg.PieceStoreConfig]
Shards = 0
[DownloaderCfg.PieceStoreConfig.Store]
Storage = "file"
BucketURL = "./data/primary_payload_data"
MaxRetries = 5
TestMode = true
#AccessKey = "ACCESSKEY"
#SecretKey = "SECRETKEY"
#SessionToken = "SESSIONTOKEN"
#NoSignRequest = false
#TlsInsecureSkipVerify = false

[UploaderCfg]
StorageProvider = "bnb-sp"
Address = "127.0.0.1:5311"
StoneHubServiceAddress = "127.0.0.1:5323"
[UploaderCfg.PieceStoreConfig]
Shards = 0
[UploaderCfg.PieceStoreConfig.Store]
Storage = "file"
BucketURL = "./debug"
AccessKey = "ACCESSKEY"
SecretKey = "SECRETKEY"
SessionToken = "SESSIONTOKEN"
NoSignRequest = false
MaxRetries = 5
TlsInsecureSkipVerify = false
TestMode = true
[UploaderCfg.MetaDBConfig]
Path = "./data"
NameSpace = "bnb-sp"
Cache = 4096
FileHandles = 1000
ReadOnly = false

[StoneHubCfg]
StorageProvider = "bnb-sp"
Address = "127.0.0.1:9333"
JobDBType = "memory"
MetaDBType = "leveldb"
[StoneHubCfg.MetaDB]
Path = "./data/meta"
NameSpace = "bnb-sp"
Cache = 4096
FileHandles = 1000
ReadOnly = false

[StoneNodeCfg]
StorageProvider = "bnb-sp"
Address = "127.0.0.1:5325"
StoneHubServiceAddress = "127.0.0.1:5323"
SyncerServiceAddress = "127.0.0.1:5324"
StorageProvider = "bnb-sp"
Address = "127.0.0.1:9433"
StoneHubServiceAddress = "127.0.0.1:9333"
SyncerServiceAddress = "127.0.0.1:9533"
StoneJobLimit = 64
[StoneNodeCfg.PieceConfig]
Shards = 0
[StoneNodeCfg.PieceConfig.Store]
Storage = "file"
BucketURL = "./debug"
AccessKey = "ACCESSKEY"
SecretKey = "SECRETKEY"
SessionToken = "SESSIONTOKEN"
NoSignRequest = false
MaxRetries = 5
TlsInsecureSkipVerify = false
TestMode = true
# Storage = "s3"
# BucketURL = "https://s3.ap-northeast-1.amazonaws.com/tf-nodereal-dev-bsc-storage"
# AccessKey = ""
# SecretKey = ""
# SessionToken = ""
# NoSignRequest = false
# MaxRetries = 5
# TlsInsecureSkipVerify = false
# TestMode = true
Shards = 0
[StoneNodeCfg.PieceConfig.Store]
Storage = "file"
BucketURL = "./data/primary_payload_data"
MaxRetries = 5
TestMode = true
#AccessKey = "ACCESSKEY"
#SecretKey = "SECRETKEY"
#SessionToken = "SESSIONTOKEN"
#NoSignRequest = false
#TlsInsecureSkipVerify = false


[SyncerCfg]
StorageProvider = "bnb-sp"
Address = "127.0.0.1:5324"
[SyncerCfg.PieceConfig]
Shards = 0
[SyncerCfg.PieceConfig.Store]
Storage = "file"
BucketURL = "./debug"
AccessKey = "ACCESSKEY"
SecretKey = "SECRETKEY"
SessionToken = "SESSIONTOKEN"
NoSignRequest = false
MaxRetries = 5
TlsInsecureSkipVerify = false
TestMode = true
# Storage = "s3"
# BucketURL = "https://s3.ap-northeast-1.amazonaws.com/tf-nodereal-dev-bsc-storage"
# AccessKey = ""
# SecretKey = ""
# SessionToken = ""
# NoSignRequest = false
# MaxRetries = 5
# TlsInsecureSkipVerify = false
# TestMode = true

[DownloaderCfg]
Address = "127.0.0.1:5523"
[DownloaderCfg.PieceStoreConfig]
Shards = 0
[DownloaderCfg.PieceStoreConfig.Store]
Storage = "file"
BucketURL = "./debug"
AccessKey = "ACCESSKEY"
SecretKey = "SECRETKEY"
SessionToken = "SESSIONTOKEN"
NoSignRequest = false
MaxRetries = 5
TlsInsecureSkipVerify = false
TestMode = true
StorageProvider = "bnb-sp"
Address = "127.0.0.1:11600"
MetaDBType = "leveldb"
[SyncerCfg.PieceConfig.Store]
Storage = "file"
BucketURL = "./data/secondary_payload_data"
MaxRetries = 5
TestMode = true
#AccessKey = "ACCESSKEY"
#SecretKey = "SECRETKEY"
#SessionToken = "SESSIONTOKEN"
#NoSignRequest = false
#TlsInsecureSkipVerify = false
[SyncerCfg.MetaDB]
Path = "./data/meta"
NameSpace = "bnb-sp"
Cache = 4096
FileHandles = 1000
ReadOnly = false
3 changes: 2 additions & 1 deletion service/downloader/downloader_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func (downloader *Downloader) DownloaderObject(req *service.DownloaderServiceDow
resp.ErrMessage = merrors.MakeErrMsgResponse(err)
err = stream.Send(resp)
}
log.CtxInfow(ctx, "download object completed", "error", err, "objectSize", objectInfo.Size, "sendSize", size)
// log.CtxInfow(ctx, "download object completed", "error", err, "objectSize", objectInfo.Size, "sendSize", size)
log.CtxInfow(ctx, "download object completed", "error", err, "sendSize", size)
}()

objectInfo, err = downloader.mockChain.QueryObjectByName(req.BucketName + "/" + req.ObjectName)
Expand Down
5 changes: 0 additions & 5 deletions test/e2e/piecestore/disk_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import (
"os"
"testing"

<<<<<<< HEAD
"github.com/bnb-chain/greenfield-storage-provider/util/log"

=======
>>>>>>> develop
"github.com/stretchr/testify/assert"

"github.com/bnb-chain/greenfield-storage-provider/util/log"
Expand Down
Loading