Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dgraph
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
dgraph
Commits
7635b2a3
Commit
7635b2a3
authored
9 years ago
by
Ashwin
Browse files
Options
Downloads
Patches
Plain Diff
Some changes after review
parent
ea17e236
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/uidassigner/main_test.go
+7
-11
7 additions, 11 deletions
server/uidassigner/main_test.go
with
7 additions
and
11 deletions
server/uidassigner/main_test.go
+
7
−
11
View file @
7635b2a3
package
main
import
(
"fmt"
"io/ioutil"
"math"
"os"
...
...
@@ -16,45 +15,42 @@ import (
)
func
TestQuery
(
t
*
testing
.
T
)
{
var
numInstances
uint64
=
2
var
mod
uint64
=
math
.
MaxUint64
/
numInstances
var
minIdx0
uint64
=
0
*
mod
var
minIdx1
uint64
=
1
*
mod
mod
:=
math
.
MaxUint64
/
numInstances
minIdx0
:=
0
*
mod
minIdx1
:=
1
*
mod
logrus
.
SetLevel
(
logrus
.
DebugLevel
)
dir
,
err
:=
ioutil
.
TempDir
(
""
,
"storetest_"
)
if
err
!=
nil
{
t
.
Error
(
err
)
return
}
defer
os
.
RemoveAll
(
dir
)
ps
:=
new
(
store
.
Store
)
ps
.
Init
(
dir
)
clog
:=
commit
.
NewLogger
(
dir
,
"mutations"
,
50
<<
20
)
clog
.
Init
()
defer
clog
.
Close
()
posting
.
Init
(
ps
,
clog
)
list
:=
[]
string
{
"alice"
,
"bob"
,
"mallory"
,
"ash"
,
"man"
,
"dgraph"
}
for
_
,
str
:=
range
list
{
if
farm
.
Fingerprint64
([]
byte
(
str
))
%
numInstances
==
0
{
uid
,
err
:=
rdf
.
GetUid
(
str
,
0
,
numInstances
)
if
uid
<
minIdx0
||
uid
>
minIdx0
+
mod
-
1
{
t
.
Error
(
"Not the correct UID"
,
err
)
}
fmt
.
Println
(
"Instance-0"
,
str
,
uid
)
t
.
Logf
(
"Instance-0"
,
str
,
uid
)
t
.
Logf
(
"Correct UID"
)
}
else
{
uid
,
err
:=
rdf
.
GetUid
(
str
,
1
,
numInstances
)
if
uid
<
minIdx1
||
uid
>
minIdx1
+
mod
-
1
{
t
.
Error
(
"Not the correct UID"
,
err
)
}
fmt
.
Println
(
"Instance-1"
,
str
,
uid
)
t
.
Logf
(
"Instance-1"
,
str
,
uid
)
t
.
Logf
(
"Correct UID"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment