MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestAdd

Function TestAdd

consistent/consistent_test.go:80–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestAdd(t *testing.T) {
81 kms.Unittest = true
82 utils.RemoveAll(testStorePath + "*")
83 kms.ResetBucket()
84
85 x, _ := InitConsistent(testStorePath, new(KMSStorage), false)
86 defer utils.RemoveAll(testStorePath + "*")
87 x.Add(NewNodeFromString("0000000000000000000000000000000000000000000000000000000000000000"))
88 CheckNum(len(x.circle), x.NumberOfReplicas, t)
89 CheckNum(len(x.sortedHashes), x.NumberOfReplicas, t)
90 if sort.IsSorted(x.sortedHashes) == false {
91 t.Error("expected sorted hashes to be sorted")
92 }
93 x.Add(NewNodeFromString(("3333333333333333333333333333333333333333333333333333333333333333")))
94 CheckNum(len(x.circle), 2*x.NumberOfReplicas, t)
95 CheckNum(len(x.sortedHashes), 2*x.NumberOfReplicas, t)
96 if sort.IsSorted(x.sortedHashes) == false {
97 t.Error("expected sorted hashes to be sorted")
98 }
99}
100
101func TestRemove(t *testing.T) {
102 kms.Unittest = true

Callers

nothing calls this directly

Calls 7

RemoveAllFunction · 0.92
ResetBucketFunction · 0.92
InitConsistentFunction · 0.85
NewNodeFromStringFunction · 0.85
ErrorMethod · 0.80
CheckNumFunction · 0.70
AddMethod · 0.45

Tested by

no test coverage detected