Skip to content

Commit

Permalink
fix monitor e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Song Gao committed Mar 30, 2020
1 parent d6145b8 commit 0309558
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions tests/e2e/tidbcluster/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,18 +753,28 @@ var _ = ginkgo.Describe("[tidb-operator] TiDBCluster", func() {
pvName := pvc.Spec.VolumeName
pv, err := c.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
framework.ExpectNoError(err, "Expected fetch tidbmonitor pv success")
value, existed := pv.Labels[label.ComponentLabelKey]
framework.ExpectEqual(existed, true)
framework.ExpectEqual(value, label.TiDBMonitorVal)
value, existed = pv.Labels[label.InstanceLabelKey]
framework.ExpectEqual(existed, true)
framework.ExpectEqual(value, "e2e-monitor")
value, existed = pv.Labels[label.InstanceLabelKey]
framework.ExpectEqual(existed, true)
framework.ExpectEqual(value, "e2e-monitor")
value, existed = pv.Labels[label.ManagedByLabelKey]
framework.ExpectEqual(existed, true)
framework.ExpectEqual(value, label.TiDBOperator)

err = wait.Poll(5*time.Second, 5*time.Minute, func() (done bool, err error) {
value, existed := pv.Labels[label.ComponentLabelKey]
if !existed || value != label.TiDBMonitorVal {
return false, nil
}
value, existed = pv.Labels[label.InstanceLabelKey]
if !existed || value != "e2e-monitor" {
return false, nil
}

value, existed = pv.Labels[label.NameLabelKey]
if !existed || value != "tidb-clustr" {
return false, nil
}
value, existed = pv.Labels[label.ManagedByLabelKey]
if !existed || value != label.TiDBOperator {
return false, nil
}
return true, nil
})
framework.ExpectNoError(err, "monitor pv label error")

// update TidbMonitor and check whether portName is updated and the nodePort is unchanged
tm, err = cli.PingcapV1alpha1().TidbMonitors(ns).Get(tm.Name, metav1.GetOptions{})
Expand Down

0 comments on commit 0309558

Please sign in to comment.