functions: 0.2.60 release [skip ci]

This commit is contained in:
Travis Reeder
2017-05-15 12:00:43 -07:00
parent 454eedd963
commit ffae780f07
18 changed files with 26 additions and 262 deletions

View File

@@ -16,9 +16,9 @@ const tmpMysql = "mysql://root:root@tcp(%v:3307)/funcs"
func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()) {
fmt.Println("initializing mysql for test")
tryRun(logf, "remove old mysql container", exec.Command("docker", "rm", "-f", "iron-mysql-test"))
tryRun(logf, "remove old mysql container", exec.Command("docker", "rm", "-f", "func-mysql-test"))
mustRun(fatalf, "start mysql container", exec.Command(
"docker", "run", "--name", "iron-mysql-test", "-p", "3307:3306", "-e", "MYSQL_DATABASE=funcs",
"docker", "run", "--name", "func-mysql-test", "-p", "3307:3306", "-e", "MYSQL_DATABASE=funcs",
"-e", "MYSQL_ROOT_PASSWORD=root", "-d", "mysql"))
maxWait := 16 * time.Second
wait := 2 * time.Second
@@ -75,7 +75,7 @@ func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()
}
},
func() {
tryRun(logf, "stop mysql container", exec.Command("docker", "rm", "-f", "iron-mysql-test"))
tryRun(logf, "stop mysql container", exec.Command("docker", "rm", "-f", "func-mysql-test"))
}
}

View File

@@ -16,8 +16,8 @@ const tmpPostgres = "postgres://postgres@%v:15432/funcs?sslmode=disable"
func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), func()) {
fmt.Println("initializing postgres for test")
tryRun(logf, "remove old postgres container", exec.Command("docker", "rm", "-f", "iron-postgres-test"))
mustRun(fatalf, "start postgres container", exec.Command("docker", "run", "--name", "iron-postgres-test", "-p", "15432:5432", "-d", "postgres"))
tryRun(logf, "remove old postgres container", exec.Command("docker", "rm", "-f", "func-postgres-test"))
mustRun(fatalf, "start postgres container", exec.Command("docker", "run", "--name", "func-postgres-test", "-p", "15432:5432", "-d", "postgres"))
wait := 1 * time.Second
for {
@@ -50,19 +50,19 @@ func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), fun
}
fmt.Println("postgres for test ready")
return func() {
db, err := sql.Open("postgres", fmt.Sprintf(tmpPostgres, datastoretest.GetContainerHostIP()))
if err != nil {
fatalf("failed to connect for truncation: %s\n", err)
}
for _, table := range []string{"routes", "apps", "extras"} {
_, err = db.Exec(`TRUNCATE TABLE ` + table)
db, err := sql.Open("postgres", fmt.Sprintf(tmpPostgres, datastoretest.GetContainerHostIP()))
if err != nil {
fatalf("failed to truncate table %q: %s\n", table, err)
fatalf("failed to connect for truncation: %s\n", err)
}
}
},
for _, table := range []string{"routes", "apps", "extras"} {
_, err = db.Exec(`TRUNCATE TABLE ` + table)
if err != nil {
fatalf("failed to truncate table %q: %s\n", table, err)
}
}
},
func() {
tryRun(logf, "stop postgres container", exec.Command("docker", "rm", "-f", "iron-postgres-test"))
tryRun(logf, "stop postgres container", exec.Command("docker", "rm", "-f", "func-postgres-test"))
}
}
@@ -96,4 +96,4 @@ func mustRun(fatalf func(string, ...interface{}), desc string, cmd *exec.Cmd) {
if err := cmd.Run(); err != nil {
fatalf("failed to %s: %s", desc, b.String())
}
}
}

View File

@@ -17,8 +17,8 @@ const tmpRedis = "redis://%v:6301/"
func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func()) {
fmt.Println("initializing redis for test")
tryRun(logf, "remove old redis container", exec.Command("docker", "rm", "-f", "iron-redis-test"))
mustRun(fatalf, "start redis container", exec.Command("docker", "run", "--name", "iron-redis-test", "-p", "6301:6379", "-d", "redis"))
tryRun(logf, "remove old redis container", exec.Command("docker", "rm", "-f", "func-redis-test"))
mustRun(fatalf, "start redis container", exec.Command("docker", "run", "--name", "func-redis-test", "-p", "6301:6379", "-d", "redis"))
timeout := time.After(20 * time.Second)
for {
@@ -41,7 +41,7 @@ func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func()
fmt.Println("redis for test ready")
return func() {},
func() {
tryRun(logf, "stop redis container", exec.Command("docker", "rm", "-f", "iron-redis-test"))
tryRun(logf, "stop redis container", exec.Command("docker", "rm", "-f", "func-redis-test"))
}
}