Merge pull request #24 from filecoin-project/test/fsrepo

Add more tests to repo
This commit is contained in:
Jakub Sztandera 2019-07-12 18:07:48 +02:00 committed by GitHub
commit 9b1843fcfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -62,7 +62,7 @@ func (fsr *FsRepo) Init() error {
log.Infof("Initializing repo at '%s'", fsr.path)
return os.Mkdir(fsr.path, 0755) // nolint
return os.Mkdir(fsr.path, 0755) //nolint: gosec
}
// APIEndpoint returns endpoint of API in this repo

View File

@ -5,6 +5,8 @@ import (
"github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/assert"
"github.com/filecoin-project/go-lotus/node/config"
)
func basicTest(t *testing.T, repo Repo) {
@ -43,6 +45,14 @@ func basicTest(t *testing.T, repo Repo) {
assert.NoError(t, err, "setting multiaddr shouldn't error")
assert.Equal(t, ma, apima, "returned API multiaddr should be the same")
iden, err := lrepo.Libp2pIdentity()
assert.NotNil(t, iden, "identity is not nil")
assert.NoError(t, err, "identity should not error")
cfg, err := lrepo.Config()
assert.Equal(t, config.Default(), cfg, "there should be a default config")
assert.NoError(t, err, "config should not error")
err = lrepo.Close()
assert.NoError(t, err, "should be able to close")