Skip to content

Commit

Permalink
fix tiny
Browse files Browse the repository at this point in the history
  • Loading branch information
shuijing198799 committed Mar 31, 2020
1 parent 1dc5e25 commit fe86df3
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions tests/e2e/tidbcluster/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ var _ = ginkgo.Describe("[tidb-operator] TiDBCluster", func() {
// import some data to sql with blockwriter
ginkgo.By(fmt.Sprintf("Begin inserting data into cluster %q", clusterFrom.ClusterName))
oa.BeginInsertDataToOrDie(&clusterFrom)
err = wait.PollImmediate(time.Second*5, time.Minute*5, utiltidb.TiDBIsInserted(fw, tcFrom.GetNamespace(), tcFrom.GetName(), "root", "", "test", "block_writer1"))
err = wait.PollImmediate(time.Second*5, time.Minute*5, utiltidb.TiDBIsInserted(fw, tcFrom.GetNamespace(), tcFrom.GetName(), "root", "", "test", "block_writer"))
framework.ExpectNoError(err)
ginkgo.By(fmt.Sprintf("Stop inserting data into cluster %q", clusterTo.ClusterName))
oa.StopInsertDataTo(&clusterFrom)
Expand Down Expand Up @@ -416,17 +416,25 @@ var _ = ginkgo.Describe("[tidb-operator] TiDBCluster", func() {
err = cli.PingcapV1alpha1().Backups(ns).Delete(backup.Name, &metav1.DeleteOptions{})
framework.ExpectNoError(err)

svc := s3.New(session.New())
input := &s3.ListObjectsV2Input{
Bucket: aws.String(backup.Spec.S3.Bucket),
Prefix: aws.String(backup.Spec.S3.Prefix),
}
result, err := svc.ListObjectsV2(input)
err = wait.PollImmediate(5*time.Second, 5*time.Minute, func() (bool, error) {
awsConfig := aws.NewConfig().
WithRegion(backup.Spec.S3.Region).
WithCredentials(cred)
svc := s3.New(session.Must(session.NewSession(awsConfig)))
input := &s3.ListObjectsV2Input{
Bucket: aws.String(backup.Spec.S3.Bucket),
Prefix: aws.String(backup.Spec.S3.Prefix),
}
result, err := svc.ListObjectsV2(input)
if err != nil {
return false, err
}
if *result.KeyCount != 0 {
return false, nil
}
return true, nil
})
framework.ExpectNoError(err)

if *result.KeyCount != 0 {
framework.ExpectNoError(nerrors.New("failed to delete remote S3 objects"))
}
})

ginkgo.It("Test aggregated apiserver", func() {
Expand Down

0 comments on commit fe86df3

Please sign in to comment.