本文整理匯總了Golang中github.com/ory-am/dockertest.ContainerID.KillRemove方法的典型用法代碼示例。如果您正苦於以下問題:Golang ContainerID.KillRemove方法的具體用法?Golang ContainerID.KillRemove怎麽用?Golang ContainerID.KillRemove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ory-am/dockertest.ContainerID
的用法示例。
在下文中一共展示了ContainerID.KillRemove方法的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)
}
}