Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: okJiang <[email protected]>
  • Loading branch information
okJiang committed Nov 14, 2024
1 parent ee91def commit 44bb9f3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/integrations/realcluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,6 @@ func waitTiupReady(t *testing.T, tag string) {
zap.String("tag", tag), zap.Error(err))
time.Sleep(time.Duration(interval) * time.Second)
}
require.Failf(t, "TiUP is not ready", "tag: %s", tag)
// this check can trigger the cleanup function
require.NotZero(t, 1, "TiUP is not ready", "tag: %s", tag)
}
22 changes: 20 additions & 2 deletions tests/integrations/realcluster/etcd_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package realcluster

import (
"fmt"
"slices"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -45,11 +46,13 @@ func TestMSEtcdKey(t *testing.T) {
}

var (
// The keys that prefix is `/pd`.
pdKeys = []string{
"",
"/pd//alloc_id",
"/pd//config",
"/pd//gc/safe_point",
// If not call `UpdateGCSafePoint`, this key will not exist.
// "/pd//gc/safe_point",
"/pd//gc/safe_point/service/gc_worker",
"/pd//keyspaces/id/DEFAULT",
"/pd//keyspaces/meta/",
Expand All @@ -70,9 +73,10 @@ var (
"/pd//scheduler_config/balance-region-scheduler",
"/pd//scheduler_config/evict-slow-store-scheduler",
"/pd//timestamp",
"/pd//tso/keyspace_groups/membership/",
"/pd//tso/keyspace_groups/membership/", // ms
"/pd/cluster_id",
}
// The keys that prefix is `/ms`.
msKeys = []string{
"",
"/ms//scheduling/primary",
Expand All @@ -82,9 +86,23 @@ var (
"/ms//tso//primary/expected_primary",
"/ms//tso/registry/http://...:",
}
// These keys with `/pd` are only in `ms` mode.
pdMSKeys = []string{
"/pd//tso/keyspace_groups/membership/",
}
)

func (s *etcdKeySuite) TestEtcdKey() {
var keysBackup []string
if !s.ms {
keysBackup = pdKeys
pdKeys = slices.DeleteFunc(pdKeys, func(s string) bool {
return slices.Contains(pdMSKeys, s)
})
defer func() {
pdKeys = keysBackup
}()
}
t := s.T()
endpoints := getPDEndpoints(t)

Expand Down

0 comments on commit 44bb9f3

Please sign in to comment.