good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
c83ba9e7
Commit
c83ba9e7
authored
6 years ago
by
Janoš Guljaš
Committed by
Viktor Trón
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
swarm/storage/localstore: fix tests for windows os (#19161)
parent
340a53a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swarm/storage/localstore/localstore_test.go
+21
-0
21 additions, 0 deletions
swarm/storage/localstore/localstore_test.go
with
21 additions
and
0 deletions
swarm/storage/localstore/localstore_test.go
+
21
−
0
View file @
c83ba9e7
...
...
@@ -22,6 +22,7 @@ import (
"io/ioutil"
"math/rand"
"os"
"runtime"
"sort"
"strconv"
"sync"
...
...
@@ -34,6 +35,26 @@ import (
"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
// correctly retrieved.
func
TestDB
(
t
*
testing
.
T
)
{
...
...
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