Skip to content

Commit

Permalink
ddl/util: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala committed Jun 13, 2019
1 parent cd2fbd8 commit 70793c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ddl/util/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ func TestSyncerSimple(t *testing.T) {
// for StartCleanWork
go d.SchemaSyncer().StartCleanWork()
ttl := 10
// Make sure NeededCleanTTL > 2/3 ttl, then we definitely clean the ttl.
NeededCleanTTL = int64(9)
// Make sure NeededCleanTTL > ttl, then we definitely clean the ttl.
NeededCleanTTL = int64(11)
ttlKey := "session_ttl_key"
ttlVal := "session_ttl_val"
session, err := owner.NewSession(ctx, "", cli, owner.NewSessionDefaultRetryCnt, ttl)
Expand Down Expand Up @@ -198,7 +198,7 @@ func TestSyncerSimple(t *testing.T) {
if err != nil {
t.Fatalf("client get version failed %v", err)
}
checkRespKV(t, 1, ttlKey, ttlVal, resp.Kvs...)
checkRespKV(t, 0, ttlKey, "", resp.Kvs...)

// for RemoveSelfVersionPath
resp, err = cli.Get(goctx.Background(), key)
Expand Down Expand Up @@ -230,6 +230,10 @@ func checkRespKV(t *testing.T, kvCount int, key, val string,
if len(kvs) != kvCount {
t.Fatalf("resp key %s kvs %v length is != 1", key, kvs)
}
if kvCount == 0 {
return
}

kv := kvs[0]
if string(kv.Key) != key {
t.Fatalf("key resp %s, exported %s", kv.Key, key)
Expand Down

0 comments on commit 70793c3

Please sign in to comment.