mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-22 09:51:01 +00:00
address review lint issues (#4354)
This commit is contained in:
parent
759e5497c9
commit
07baae28af
3 changed files with 12 additions and 12 deletions
|
@ -252,10 +252,10 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
|
||||||
|
|
||||||
finished := make(chan bool)
|
finished := make(chan bool)
|
||||||
|
|
||||||
podUpdated := func(_, new any) {
|
podUpdated := func(_, newPod any) {
|
||||||
pod, ok := new.(*v1.Pod)
|
pod, ok := newPod.(*v1.Pod)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Error().Msgf("could not parse pod: %v", new)
|
log.Error().Msgf("could not parse pod: %v", newPod)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,10 +328,10 @@ func (e *kube) TailStep(ctx context.Context, step *types.Step, taskUUID string)
|
||||||
|
|
||||||
up := make(chan bool)
|
up := make(chan bool)
|
||||||
|
|
||||||
podUpdated := func(_, new any) {
|
podUpdated := func(_, newPod any) {
|
||||||
pod, ok := new.(*v1.Pod)
|
pod, ok := newPod.(*v1.Pod)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Error().Msgf("could not parse pod: %v", new)
|
log.Error().Msgf("could not parse pod: %v", newPod)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,14 @@ import (
|
||||||
"xorm.io/xorm/schemas"
|
"xorm.io/xorm/schemas"
|
||||||
)
|
)
|
||||||
|
|
||||||
func renameTable(sess *xorm.Session, old, new string) error {
|
func renameTable(sess *xorm.Session, oldTable, newTable string) error {
|
||||||
dialect := sess.Engine().Dialect().URI().DBType
|
dialect := sess.Engine().Dialect().URI().DBType
|
||||||
switch dialect {
|
switch dialect {
|
||||||
case schemas.MYSQL:
|
case schemas.MYSQL:
|
||||||
_, err := sess.Exec(fmt.Sprintf("RENAME TABLE `%s` TO `%s`;", old, new))
|
_, err := sess.Exec(fmt.Sprintf("RENAME TABLE `%s` TO `%s`;", oldTable, newTable))
|
||||||
return err
|
return err
|
||||||
case schemas.POSTGRES, schemas.SQLITE:
|
case schemas.POSTGRES, schemas.SQLITE:
|
||||||
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` RENAME TO `%s`;", old, new))
|
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` RENAME TO `%s`;", oldTable, newTable))
|
||||||
return err
|
return err
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("dialect '%s' not supported", dialect)
|
return fmt.Errorf("dialect '%s' not supported", dialect)
|
||||||
|
|
|
@ -57,14 +57,14 @@ func createSQLiteDB(t *testing.T) string {
|
||||||
return tmpF.Name()
|
return tmpF.Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDB(t *testing.T, new bool) (engine *xorm.Engine, closeDB func()) {
|
func testDB(t *testing.T, initNewDB bool) (engine *xorm.Engine, closeDB func()) {
|
||||||
driver := testDriver()
|
driver := testDriver()
|
||||||
var err error
|
var err error
|
||||||
closeDB = func() {}
|
closeDB = func() {}
|
||||||
switch driver {
|
switch driver {
|
||||||
case "sqlite3":
|
case "sqlite3":
|
||||||
config := ":memory:"
|
config := ":memory:"
|
||||||
if !new {
|
if !initNewDB {
|
||||||
config = createSQLiteDB(t)
|
config = createSQLiteDB(t)
|
||||||
closeDB = func() {
|
closeDB = func() {
|
||||||
_ = os.Remove(config)
|
_ = os.Remove(config)
|
||||||
|
@ -77,7 +77,7 @@ func testDB(t *testing.T, new bool) (engine *xorm.Engine, closeDB func()) {
|
||||||
return
|
return
|
||||||
case "mysql", "postgres":
|
case "mysql", "postgres":
|
||||||
config := os.Getenv("WOODPECKER_DATABASE_DATASOURCE")
|
config := os.Getenv("WOODPECKER_DATABASE_DATASOURCE")
|
||||||
if !new {
|
if !initNewDB {
|
||||||
t.Logf("do not have dump to test against")
|
t.Logf("do not have dump to test against")
|
||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue