Add test case for issue #93.
This commit is contained in:
parent
a7ff84a674
commit
41cb2e7a68
|
@ -48,6 +48,7 @@ func (s *IntegrationSuite) TestAllNamespacesReturnResults(c *C) {
|
|||
}
|
||||
}()
|
||||
|
||||
|
||||
// Open a database connection
|
||||
db, err := sql.Open("postgres", s.e.dsn)
|
||||
c.Assert(db, NotNil)
|
||||
|
@ -73,3 +74,17 @@ func (s *IntegrationSuite) TestAllNamespacesReturnResults(c *C) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestInvalidDsnDoesntCrash tests that specifying an invalid DSN doesn't crash the exporter.
|
||||
// https://github.com/wrouesnel/postgres_exporter/issues/93
|
||||
func (s *IntegrationSuite) TestInvalidDsnDoesntCrash(c *C) {
|
||||
// Setup a dummy channel to consume metrics
|
||||
ch := make(chan prometheus.Metric, 100)
|
||||
go func() {
|
||||
for range ch {
|
||||
}
|
||||
}()
|
||||
|
||||
exporter := NewExporter("an invalid dsn", *queriesPath)
|
||||
exporter.scrape(ch)
|
||||
}
|
Loading…
Reference in New Issue