GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix consistent test · CovenantSQL/CovenantSQL@7cf7e44

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • consistent
    • consistent.go
    • consistent_test.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎consistent/consistent.go‎

Copy file name to clipboardExpand all lines: consistent/consistent.go
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func InitConsistent(storePath string, initBP bool) (c *Consistent, err error) {
9999
return
100100
}
101101
c = &Consistent{
102+
//TODO(auxten): reduce NumberOfReplicas
102103
NumberOfReplicas: 20,
103104
circle: make(map[proto.NodeKey]proto.Node),
104105
}
Collapse file

‎consistent/consistent_test.go‎

Copy file name to clipboardExpand all lines: consistent/consistent_test.go
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func TestNew(t *testing.T) {
5656
if x == nil {
5757
t.Errorf("expected obj")
5858
}
59-
utils.CheckNum(x.NumberOfReplicas, 20, t)
6059
}
6160

6261
func TestAdd(t *testing.T) {
@@ -67,14 +66,14 @@ func TestAdd(t *testing.T) {
6766
x, _ := InitConsistent(testStorePath, false)
6867
defer os.Remove(testStorePath)
6968
x.Add(NewNodeFromID("abcdefg"))
70-
utils.CheckNum(len(x.circle), 20, t)
71-
utils.CheckNum(len(x.sortedHashes), 20, t)
69+
utils.CheckNum(len(x.circle), x.NumberOfReplicas, t)
70+
utils.CheckNum(len(x.sortedHashes), x.NumberOfReplicas, t)
7271
if sort.IsSorted(x.sortedHashes) == false {
7372
t.Errorf("expected sorted hashes to be sorted")
7473
}
7574
x.Add(NewNodeFromID(("qwer")))
76-
utils.CheckNum(len(x.circle), 40, t)
77-
utils.CheckNum(len(x.sortedHashes), 40, t)
75+
utils.CheckNum(len(x.circle), 2*x.NumberOfReplicas, t)
76+
utils.CheckNum(len(x.sortedHashes), 2*x.NumberOfReplicas, t)
7877
if sort.IsSorted(x.sortedHashes) == false {
7978
t.Errorf("expected sorted hashes to be sorted")
8079
}
@@ -102,7 +101,7 @@ func TestRemoveNonExisting(t *testing.T) {
102101
defer os.Remove(testStorePath)
103102
x.Add(NewNodeFromID("abcdefg"))
104103
x.Remove("abcdefghijk")
105-
utils.CheckNum(len(x.circle), 20, t)
104+
utils.CheckNum(len(x.circle), x.NumberOfReplicas, t)
106105
}
107106

108107
func TestGetEmpty(t *testing.T) {

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.