Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
c83ba9e7
Commit
c83ba9e7
authored
Feb 26, 2019
by
Janoš Guljaš
Committed by
Viktor Trón
Feb 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/storage/localstore: fix tests for windows os (#19161)
parent
340a53a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
localstore_test.go
swarm/storage/localstore/localstore_test.go
+21
-0
No files found.
swarm/storage/localstore/localstore_test.go
View file @
c83ba9e7
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"io/ioutil"
"io/ioutil"
"math/rand"
"math/rand"
"os"
"os"
"runtime"
"sort"
"sort"
"strconv"
"strconv"
"sync"
"sync"
...
@@ -34,6 +35,26 @@ import (
...
@@ -34,6 +35,26 @@ import (
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb"
)
)
func
init
()
{
// Some of the tests in localstore package rely on the same ordering of
// items uploaded or accessed compared to the ordering of items in indexes
// that contain StoreTimestamp or AccessTimestamp in keys. In tests
// where the same order is required from the database as the order
// in which chunks are put or accessed, if the StoreTimestamp or
// AccessTimestamp are the same for two or more sequential items
// their order in database will be based on the chunk address value,
// in which case the ordering of items/chunks stored in a test slice
// will not be the same. To ensure the same ordering in database on such
// indexes on windows systems, an additional short sleep is added to
// the now function.
if
runtime
.
GOOS
==
"windows"
{
setNow
(
func
()
int64
{
time
.
Sleep
(
time
.
Microsecond
)
return
time
.
Now
()
.
UTC
()
.
UnixNano
()
})
}
}
// TestDB validates if the chunk can be uploaded and
// TestDB validates if the chunk can be uploaded and
// correctly retrieved.
// correctly retrieved.
func
TestDB
(
t
*
testing
.
T
)
{
func
TestDB
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment