Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Oct 31, 2024
1 parent a47e809 commit 3b2a0a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions tests/integrations/realcluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func (s *clusterSuite) SetupSuite() {
for _, match := range matches {
require.NoError(t, runCommand("rm", "-rf", match))
}
s.startRealCluster(t)
s.startCluster(t)
t.Cleanup(func() {
s.stopRealCluster(t)
s.stopCluster(t)
})
}

Expand All @@ -65,10 +65,10 @@ func (s *clusterSuite) TearDownSuite() {
// If the cluster does not fail to deploy, the cluster will be destroyed in
// the cleanup function. And these code will not work.
s.clusterCnt++
s.stopRealCluster(s.T())
s.stopCluster(s.T())
}

func (s *clusterSuite) startRealCluster(t *testing.T) {
func (s *clusterSuite) startCluster(t *testing.T) {
log.Info("start to deploy a real cluster")

tag := s.tag()
Expand All @@ -77,7 +77,7 @@ func (s *clusterSuite) startRealCluster(t *testing.T) {
s.clusterCnt++
}

func (s *clusterSuite) stopRealCluster(t *testing.T) {
func (s *clusterSuite) stopCluster(t *testing.T) {
s.clusterCnt--

log.Info("start to destroy a real cluster", zap.String("tag", s.tag()))
Expand All @@ -92,8 +92,8 @@ func (s *clusterSuite) tag() string {
func (s *clusterSuite) restart() {
tag := s.tag()
log.Info("start to restart", zap.String("tag", tag))
s.stopRealCluster(s.T())
s.startRealCluster(s.T())
s.stopCluster(s.T())
s.startCluster(s.T())
log.Info("TiUP restart success")
}

Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/realcluster/cluster_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func (s *clusterIDSuite) TestClientClusterID() {
re := require.New(s.T())
ctx := context.Background()
// deploy second cluster
s.startRealCluster(s.T())
defer s.stopRealCluster(s.T())
s.startCluster(s.T())
defer s.stopCluster(s.T())

pdEndpoints := getPDEndpoints(s.T())
// Try to create a client with the mixed endpoints.
Expand Down

0 comments on commit 3b2a0a7

Please sign in to comment.