Skip to content

Commit b6c191f

Browse files
committed
mysqlcluster: wait until file exist #728
1 parent b82fd46 commit b6c191f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

mysqlcluster/container/auditlog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (c *auditLog) getImage() string {
4444
// getCommand get the container command.
4545
func (c *auditLog) getCommand() []string {
4646
logsName := "/mysql-audit.log"
47-
return []string{"sh", "-c", "for i in {120..0}; do if [ -f " + utils.LogsVolumeMountPath + logsName + " ] ; then break; fi;sleep 1; done; " +
47+
return []string{"sh", "-c", "while true; do if [ -f " + utils.LogsVolumeMountPath + logsName + " ] ; then break; fi;sleep 1; done; " +
4848
"tail -f " + utils.LogsVolumeMountPath + logsName}
4949
}
5050

mysqlcluster/container/auditlog_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var (
4242
MysqlCluster: &auditlogMysqlCluster,
4343
}
4444
auditLogCase = EnsureContainer("auditlog", &testAuditlogCluster)
45-
auditlogCommand = []string{"sh", "-c", "for i in {120..0}; do if [ -f /var/log/mysql/mysql-audit.log ] ; then break; fi;sleep 1; done; tail -f /var/log/mysql/mysql-audit.log"}
45+
auditlogCommand = []string{"sh", "-c", "while true; do if [ -f /var/log/mysql/mysql-audit.log ] ; then break; fi;sleep 1; done; tail -f /var/log/mysql/mysql-audit.log"}
4646
auditlogVolumeMounts = []corev1.VolumeMount{
4747
{
4848
Name: "logs",

mysqlcluster/container/slowlog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (c *slowLog) getImage() string {
4444
// getCommand get the container command.
4545
func (c *slowLog) getCommand() []string {
4646
logsName := "/mysql-slow.log"
47-
return []string{"sh", "-c", "for i in {120..0}; do if [ -f " + utils.LogsVolumeMountPath + logsName + " ] ; then break; fi;sleep 1; done; " +
47+
return []string{"sh", "-c", "while true; do if [ -f " + utils.LogsVolumeMountPath + logsName + " ] ; then break; fi;sleep 1; done; " +
4848
"tail -f " + utils.LogsVolumeMountPath + logsName}
4949
}
5050

mysqlcluster/container/slowlog_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestGetSlowlogImage(t *testing.T) {
5353
}
5454

5555
func TestGetSlowlogCommand(t *testing.T) {
56-
command := []string{"sh", "-c", "for i in {120..0}; do if [ -f /var/log/mysql/mysql-slow.log ] ; then break; fi;sleep 1; done; tail -f /var/log/mysql/mysql-slow.log"}
56+
command := []string{"sh", "-c", "while true; do if [ -f /var/log/mysql/mysql-slow.log ] ; then break; fi;sleep 1; done; tail -f /var/log/mysql/mysql-slow.log"}
5757
assert.Equal(t, command, slowlogCase.Command)
5858
}
5959

0 commit comments

Comments
 (0)