Files
athens/pkg/storage/mongo/local_test.go
marpio 29b6b6ffab Minio conf + tests refactoring (#680)
* cleanup tests and change minio port

* fix cleanup

* cleanup

* fix config test

* add comment to travis

* revert to generic minio addr

* fix test

* switch to test config

* adapt timeouts

* use example config

* fix test... again

* add new lines
2018-09-20 21:31:21 +02:00

41 lines
798 B
Go

package mongo
import (
"path/filepath"
"testing"
"github.com/gomods/athens/pkg/config"
"github.com/stretchr/testify/suite"
)
var (
testConfigFile = filepath.Join("..", "..", "..", "config.test.toml")
)
type MongoTests struct {
suite.Suite
}
func (m *MongoTests) SetupTest() {
conf := config.GetConfLogErr(testConfigFile, m.T())
_, err := newTestStore(conf.Storage.Mongo)
m.Require().NoError(err)
}
func (m *MongoTests) TestNewMongoStorage() {
r := m.Require()
conf := config.GetConfLogErr(testConfigFile, m.T())
getterSaver, err := NewStorage(conf.Storage.Mongo)
r.NoError(err)
r.NotNil(getterSaver.c)
r.NotNil(getterSaver.d)
r.NotNil(getterSaver.s)
r.Equal(getterSaver.url, conf.Storage.Mongo.URL)
}
func TestMongoStorage(t *testing.T) {
suite.Run(t, new(MongoTests))
}