本文整理汇总了Golang中github.com/ory-am/dockertest.ContainerID类的典型用法代码示例。如果您正苦于以下问题:Golang ContainerID类的具体用法?Golang ContainerID怎么用?Golang ContainerID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContainerID类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestMain
func TestMain(m *testing.M) {
var db *sqlx.DB
var err error
var c dockertest.ContainerID
if c, err = dockertest.ConnectToPostgreSQL(15, time.Second, func(url string) bool {
var err error
db, err = sqlx.Open("postgres", url)
if err != nil {
return false
}
return db.Ping() == nil
}); err != nil {
log.Fatalf("Could not connect to database: %s", err)
}
s = &PostgresStore{DB: db}
if err := s.CreateSchemas(); err != nil {
log.Fatalf("Could not set up schemas: %v", err)
}
if err := s.CreateSchemas(); err != nil {
log.Fatalf("Schema did fail on second time: %v", err)
}
result := m.Run()
c.KillRemove()
os.Exit(result)
}
示例2: TestMain
func TestMain(m *testing.M) {
var err error
var c dockertest.ContainerID
c, db, err = dockertest.OpenPostgreSQLContainerConnection(15, time.Second)
if err != nil {
log.Fatalf("Could not connect to database: %s", err)
}
defer c.KillRemove()
ladonStore = ladon.New(db)
if err := ladonStore.CreateSchemas(); err != nil {
log.Fatalf("Could not set up schemas: %v", err)
}
os.Exit(m.Run())
}
示例3: TestMain
func TestMain(m *testing.M) {
var err error
var c dockertest.ContainerID
c, db, err = dockertest.OpenPostgreSQLContainerConnection(15, time.Millisecond*500)
if err != nil {
log.Fatalf("Could not set up PostgreSQL container: %v", err)
}
defer c.KillRemove()
store = New(db)
if err = store.CreateSchemas(); err != nil {
log.Fatalf("Could not set up schemas: %v", err)
}
os.Exit(m.Run())
}
示例4: cleanupTestContainer
func cleanupTestContainer(t *testing.T, cid dockertest.ContainerID) {
err := cid.KillRemove()
if err != nil {
t.Fatal(err)
}
}