Add more tests to repo

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera 2019-07-12 17:22:29 +02:00
parent ea2039ecb6
commit 46a93d2448
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) 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 // APIEndpoint returns endpoint of API in this repo

View File

@ -5,6 +5,8 @@ import (
"github.com/multiformats/go-multiaddr" "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/filecoin-project/go-lotus/node/config"
) )
func basicTest(t *testing.T, repo Repo) { 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.NoError(t, err, "setting multiaddr shouldn't error")
assert.Equal(t, ma, apima, "returned API multiaddr should be the same") 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() err = lrepo.Close()
assert.NoError(t, err, "should be able to close") assert.NoError(t, err, "should be able to close")