projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
14717: Refactor run_test_server.py and run_test.sh to use config.yml
[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..ac5d130d61bdd85dfc568bf91c37b983994ae40c 100644
(file)
--- a/
services/ws/event_source_test.go
+++ b/
services/ws/event_source_test.go
@@
-1,12
+1,18
@@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
package main
import (
"database/sql"
"fmt"
package main
import (
"database/sql"
"fmt"
+ "os"
+ "path/filepath"
"sync"
"time"
"sync"
"time"
- "git.curoverse.com/arvados.git/sdk/go/
config
"
+ "git.curoverse.com/arvados.git/sdk/go/
arvados
"
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(filepath.Join(os.Getenv("WORKSPACE"), "tmp", "arvados.yml"))
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,7
+44,7
@@
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,
}
go pges.Run()
QueueSize: 4,
}
go pges.Run()