-
Notifications
You must be signed in to change notification settings - Fork 501
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
tidb stability test main function #306
Conversation
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'd better use goimports or gofmt to format the code.
tests/actions.go
Outdated
@@ -43,6 +49,11 @@ func NewOperatorActions(cli versioned.Interface, kubeCli kubernetes.Interface) O | |||
} | |||
} | |||
|
|||
const ( | |||
WAITMINUTE time.Duration = 10 | |||
WAITSECOND time.Duration = 5 |
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.
How about
DefaultPollInterval = 10 * time.Second
DefaultPollTimeout = 5 * time.Minute
tests/actions.go
Outdated
func (oa *operatorActions) CheckAdHocBackup(info *TidbClusterInfo) error { | ||
glog.Infof("begin to clean adhoc backup") | ||
defer func() { | ||
glog.Infof("deploy clean backup end") |
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.
clean backup -> check 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.
clean is not necessary, for the CleanTidbCluster function will delete all the resources。 but check is necessary for wait the back completed
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.
I mean there is a typo in log message.
tests/actions.go
Outdated
} | ||
var buffer bytes.Buffer | ||
for k,v := range sets { | ||
set := fmt.Sprintf("-l %s=%s",k , v) |
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.
let sets = {"foo": "a", "bar": "b"}, you finally get a buffer with "-l foo=a-l bar=b"
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.
there is only one pair in this field , I make some change .thx
tests/actions.go
Outdated
} | ||
|
||
setStr := buffer.String() | ||
cmd := fmt.Sprintf("helm update %s /charts/%s/tidb-cluster %s", |
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.
upgrade ?
tests/actions.go
Outdated
glog.Infof("deploy check scheduler end") | ||
}() | ||
|
||
jobName := fmt.Sprintf("%s--scheduled-backup",info.ClusterName) |
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.
double dash ?
@@ -7,6 +7,9 @@ images/tidb-operator-e2e/tidb-operator/ | |||
tmp/ | |||
data/ | |||
.idea | |||
cscope.files |
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.
What are these files?
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.
it's ctags generate files only use for me
tests/actions.go
Outdated
@@ -43,6 +49,11 @@ func NewOperatorActions(cli versioned.Interface, kubeCli kubernetes.Interface) O | |||
} | |||
} | |||
|
|||
const ( | |||
DefaultPollTimeout time.Duration = 10 * time.Minute | |||
DefaultPollInterval time.Duration = 5 * 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.
This should be 1 * time.Minute
, a longer interval is better.
tests/actions.go
Outdated
|
||
//for the test should add two clusters in a namespace, so we | ||
//has to use clustername as an label. | ||
sets := map[string]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.
use label.New().Instance().String()
instead
tests/actions.go
Outdated
} | ||
} | ||
|
||
setStr := buffer.String() | ||
resources := []string{"cronjobs", "jobs", "pods", "pvc"} |
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.
Only need to delete pvc .
tests/actions.go
Outdated
@@ -311,6 +361,22 @@ func (oa *operatorActions) CheckTidbClusterStatus(info *TidbClusterInfo) error { | |||
return nil | |||
} | |||
|
|||
func (oa *operatorActions) CreateSecret(info *TidbClusterInfo) 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.
Remove this func from this PR. May be another pr.
tests/actions.go
Outdated
@@ -811,3 +868,470 @@ func checkoutTag(tagName string) error { | |||
|
|||
return nil | |||
} | |||
|
|||
//scheduler backup, make sure there are serveral backup record is generated, and |
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.
Please remove all the backup related codes from this PR. It should be another PR.
pkg/label/label.go
Outdated
@@ -138,3 +140,25 @@ func (l Label) LabelSelector() *metav1.LabelSelector { | |||
func (l Label) Labels() map[string]string { | |||
return l | |||
} | |||
|
|||
//Labels convers label to 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.
// String converts label to a string
pkg/label/label.go
Outdated
@@ -138,3 +140,25 @@ func (l Label) LabelSelector() *metav1.LabelSelector { | |||
func (l Label) Labels() map[string]string { | |||
return l | |||
} | |||
|
|||
//Labels convers label to string | |||
func (l Label) String() (string,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.
gofmt
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.
func (l Label) String() string {
var arr []string
for k, v := range l {
arr = append(arr, fmt.Sprintf("%s=%s", k, v))
}
return strings.Join(arr, ",")
}
tests/actions.go
Outdated
@@ -228,10 +246,17 @@ func (oa *operatorActions) CleanTidbCluster(info *TidbClusterInfo) error { | |||
} | |||
} | |||
|
|||
resources := []string{"cronjobs", "jobs", "pods", "pvc"} | |||
//for the test should add two clusters in a namespace, so we |
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.
delete these lines.
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/labels" | ||
"strings" |
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.
import (
"fmt"
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
)
format code
@@ -204,6 +212,10 @@ func (oa *operatorActions) DumpAllLogs(info *OperatorInfo, clusterInfo *TidbClus | |||
} | |||
|
|||
func (oa *operatorActions) DeployTidbCluster(info *TidbClusterInfo) error { | |||
glog.Infof("begin to deploy tidb cluster") |
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.
print more info about the cluster, like name
and namespace
@@ -215,10 +227,13 @@ func (oa *operatorActions) DeployTidbCluster(info *TidbClusterInfo) error { | |||
} | |||
|
|||
func (oa *operatorActions) CleanTidbCluster(info *TidbClusterInfo) error { | |||
glog.Infof("begin to clean tidb cluster") |
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.
ditto
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
tidb stability main func
tidb stability main func
commit the main function of TiDB-operator stability test. and create 2 cluster for test.
PTLA @weekface @cwen0 @zyguan @tennix