ipld-eth-server/pkg/config/config_test.go

32 lines
873 B
Go
Raw Normal View History

2017-11-02 22:37:27 +00:00
package config_test
import (
"path/filepath"
cfg "github.com/8thlight/vulcanizedb/pkg/config"
2017-11-02 22:37:27 +00:00
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Loading the config", func() {
It("reads the private config using the environment", func() {
privateConfig, err := cfg.NewConfig("private")
2017-11-02 22:37:27 +00:00
Expect(err).To(BeNil())
2017-11-02 22:37:27 +00:00
Expect(privateConfig.Database.Hostname).To(Equal("localhost"))
Expect(privateConfig.Database.Name).To(Equal("vulcanize_private"))
Expect(privateConfig.Database.Port).To(Equal(5432))
expandedPath := filepath.Join(cfg.ProjectRoot(), "test_data_dir/geth.ipc")
2017-11-02 22:37:27 +00:00
Expect(privateConfig.Client.IPCPath).To(Equal(expandedPath))
})
It("returns an error when there is no matching config file", func() {
config, err := cfg.NewConfig("bad-config")
Expect(config).To(Equal(cfg.Config{}))
Expect(err).NotTo(BeNil())
})
2017-11-02 22:37:27 +00:00
})