-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add scheduled-backup test case #322
add scheduled-backup test case #322
Conversation
tests/actions.go
Outdated
@@ -252,6 +260,11 @@ func (oa *operatorActions) CleanTidbCluster(info *TidbClusterInfo) error { | |||
} | |||
} | |||
|
|||
_, err := oa.kubeCli.CoreV1().Pods(info.Namespace).Get(getBackupDirPodName, metav1.GetOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helm del won't delete these pods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this pod is create for get dirs, not manager by helm
tests/actions.go
Outdated
return fmt.Errorf("failed to launch scheduler backup job: %v", err) | ||
} | ||
|
||
backupDir, err = oa.getBackupDir(info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use global var backupDir
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
tests/actions.go
Outdated
|
||
dirs := strings.Split(string(res), "\n") | ||
glog.Infof("dirs in pod info name [%s] dir name [%s]", info.Name, strings.Join(dirs, ",")) | ||
return strings.TrimSpace(dirs[0]), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should assert the count of dirs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
tests/backup/backupcase.go
Outdated
@@ -70,5 +70,20 @@ func (bc *BackupCase) Run() error { | |||
return err | |||
} | |||
|
|||
bc.srcCluster.Name = "demo-scheduled-backup" | |||
bc.desCluster.Name = "demo-scheduled-backup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need desCluster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
tests/cmd/e2e/main.go
Outdated
@@ -88,6 +93,7 @@ func main() { | |||
} | |||
|
|||
restoreClusterInfo := &tests.TidbClusterInfo{ | |||
Name: "test-backup", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the name as same as clusterInfo
name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name is pvc name, clusterinfo name is clustername in the test case
@@ -49,14 +49,10 @@ func NewOperatorActions(cli versioned.Interface, kubeCli kubernetes.Interface) O | |||
|
|||
const ( | |||
DefaultPollTimeout time.Duration = 10 * time.Minute | |||
DefaultPollInterval time.Duration = 1 * time.Minute | |||
DefaultPollInterval time.Duration = 10 * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change this to 10 seconds, it will be very noisy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xiaojing and I need to check the log and scheduledbackup-cronjob is called job every minute
tests/actions.go
Outdated
@@ -918,11 +913,6 @@ func (oa *operatorActions) CheckAdHocBackup(info *TidbClusterInfo) error { | |||
return fmt.Errorf("failed to launch scheduler backup job: %v", err) | |||
} | |||
|
|||
backupDir, err = oa.getBackupDir(info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must ensure the returned backupDir
is not empty.
tests/actions.go
Outdated
@@ -1193,7 +1190,7 @@ func getParentUIDFromJob(j batchv1.Job) (types.UID, bool) { | |||
return controllerRef.UID, true | |||
} | |||
|
|||
func (oa *operatorActions) getBackupDir(info *TidbClusterInfo) (string, error) { | |||
func (oa *operatorActions) getBackupDir(info *TidbClusterInfo) (int, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return a []string
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* add scheduled-backup test case
* add scheduled-backup test case
* en: separate client certificates for each component * Update enable-tls-for-mysql-client.md * Apply suggestions from code review Co-authored-by: TomShawn <[email protected]> * Apply suggestions from code review Co-authored-by: TomShawn <[email protected]> Co-authored-by: TomShawn <[email protected]> Co-authored-by: pingcap-github-bot <[email protected]>
add scheduler test case
2.add a function to get backup dir
@weekface @zyguan @xiaojingchen @tennix @cwen0 PTAL