projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
16552: Add arvados-server init -admin-email option.
[arvados.git]
/
services
/
ws
/
event_source_test.go
diff --git
a/services/ws/event_source_test.go
b/services/ws/event_source_test.go
index 94e3ba3ea0e9ac61e376a4fad212182f5de15a0e..b7b8ac3006f3fa6af19de31737af82129dbf8642 100644
(file)
--- a/
services/ws/event_source_test.go
+++ b/
services/ws/event_source_test.go
@@
-1,4
+1,8
@@
-package main
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package ws
import (
"database/sql"
import (
"database/sql"
@@
-6,7
+10,9
@@
import (
"sync"
"time"
"sync"
"time"
- "git.curoverse.com/arvados.git/sdk/go/config"
+ "git.arvados.org/arvados.git/sdk/go/arvados"
+ "git.arvados.org/arvados.git/sdk/go/ctxlog"
+ "github.com/prometheus/client_golang/prometheus"
check "gopkg.in/check.v1"
)
check "gopkg.in/check.v1"
)
@@
-14,30
+20,20
@@
var _ = check.Suite(&eventSourceSuite{})
type eventSourceSuite struct{}
type eventSourceSuite struct{}
-func testDBConfig() pgConfig {
- var railsDB struct {
- Test struct {
- Database string
- Username string
- Password string
- Host string
- }
- }
- err := config.LoadFile(&railsDB, "../api/config/database.yml")
+func testDBConfig() arvados.PostgreSQLConnection {
+ cfg, err := arvados.GetConfig(arvados.DefaultConfigFile)
if err != nil {
panic(err)
}
if err != nil {
panic(err)
}
- cfg := pgConfig{
- "dbname": railsDB.Test.Database,
- "host": railsDB.Test.Host,
- "password": railsDB.Test.Password,
- "user": railsDB.Test.Username,
+ cc, err := cfg.GetCluster("zzzzz")
+ if err != nil {
+ panic(err)
}
}
- return c
fg
+ return c
c.PostgreSQL.Connection
}
func testDB() *sql.DB {
}
func testDB() *sql.DB {
- db, err := sql.Open("postgres", testDBConfig().
Connection
String())
+ db, err := sql.Open("postgres", testDBConfig().String())
if err != nil {
panic(err)
}
if err != nil {
panic(err)
}
@@
-48,8
+44,10
@@
func (*eventSourceSuite) TestEventSource(c *check.C) {
cfg := testDBConfig()
db := testDB()
pges := &pgEventSource{
cfg := testDBConfig()
db := testDB()
pges := &pgEventSource{
- DataSource: cfg.
Connection
String(),
+ DataSource: cfg.String(),
QueueSize: 4,
QueueSize: 4,
+ Logger: ctxlog.TestLogger(c),
+ Reg: prometheus.NewRegistry(),
}
go pges.Run()
sinks := make([]eventSink, 18)
}
go pges.Run()
sinks := make([]eventSink, 18)