Skip to content
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

Merged

Conversation

shuijing198799
Copy link
Contributor

add scheduler test case

  1. add scheduler test case
    2.add a function to get backup dir
    @weekface @zyguan @xiaojingchen @tennix @cwen0 PTAL

@shuijing198799 shuijing198799 changed the title add schduler test case add scheduled-backup test case Mar 16, 2019
@weekface weekface added the test/stability stability tests label Mar 18, 2019
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{})
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@@ -70,5 +70,20 @@ func (bc *BackupCase) Run() error {
return err
}

bc.srcCluster.Name = "demo-scheduled-backup"
bc.desCluster.Name = "demo-scheduled-backup"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need desCluster

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@@ -88,6 +93,7 @@ func main() {
}

restoreClusterInfo := &tests.TidbClusterInfo{
Name: "test-backup",
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return a []string?

Copy link
Contributor

@xiaojingchen xiaojingchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@weekface weekface merged commit 61652fc into pingcap:stability Mar 19, 2019
weekface pushed a commit to weekface/tidb-operator that referenced this pull request Mar 21, 2019
* add scheduled-backup test case
tennix pushed a commit that referenced this pull request Mar 21, 2019
* add scheduled-backup test case
yahonda pushed a commit that referenced this pull request Dec 27, 2021
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test/stability stability tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants