mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
* 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
41 lines
798 B
Go
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))
|
|
}
|