Removing dependencies from pkg into Docker internal code
Closes #10922 Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
This commit is contained in:
parent
3d26fc868b
commit
c9b4e665f9
2 changed files with 54 additions and 16 deletions
|
@ -4,7 +4,7 @@ import (
|
|||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/docker/pkg/common"
|
||||
)
|
||||
|
||||
// Test the behavior of TruncIndex, an index for querying IDs from a non-conflicting prefix.
|
||||
|
@ -111,7 +111,7 @@ func assertIndexGet(t *testing.T, index *TruncIndex, input, expectedResult strin
|
|||
func BenchmarkTruncIndexAdd100(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 100; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -127,7 +127,7 @@ func BenchmarkTruncIndexAdd100(b *testing.B) {
|
|||
func BenchmarkTruncIndexAdd250(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 250; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -143,7 +143,7 @@ func BenchmarkTruncIndexAdd250(b *testing.B) {
|
|||
func BenchmarkTruncIndexAdd500(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 500; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -160,7 +160,7 @@ func BenchmarkTruncIndexGet100(b *testing.B) {
|
|||
var testSet []string
|
||||
var testKeys []string
|
||||
for i := 0; i < 100; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
index := NewTruncIndex([]string{})
|
||||
for _, id := range testSet {
|
||||
|
@ -184,7 +184,7 @@ func BenchmarkTruncIndexGet250(b *testing.B) {
|
|||
var testSet []string
|
||||
var testKeys []string
|
||||
for i := 0; i < 250; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
index := NewTruncIndex([]string{})
|
||||
for _, id := range testSet {
|
||||
|
@ -208,7 +208,7 @@ func BenchmarkTruncIndexGet500(b *testing.B) {
|
|||
var testSet []string
|
||||
var testKeys []string
|
||||
for i := 0; i < 500; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
index := NewTruncIndex([]string{})
|
||||
for _, id := range testSet {
|
||||
|
@ -231,7 +231,7 @@ func BenchmarkTruncIndexGet500(b *testing.B) {
|
|||
func BenchmarkTruncIndexDelete100(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 100; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -254,7 +254,7 @@ func BenchmarkTruncIndexDelete100(b *testing.B) {
|
|||
func BenchmarkTruncIndexDelete250(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 250; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -277,7 +277,7 @@ func BenchmarkTruncIndexDelete250(b *testing.B) {
|
|||
func BenchmarkTruncIndexDelete500(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 500; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -300,7 +300,7 @@ func BenchmarkTruncIndexDelete500(b *testing.B) {
|
|||
func BenchmarkTruncIndexNew100(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 100; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -311,7 +311,7 @@ func BenchmarkTruncIndexNew100(b *testing.B) {
|
|||
func BenchmarkTruncIndexNew250(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 250; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -322,7 +322,7 @@ func BenchmarkTruncIndexNew250(b *testing.B) {
|
|||
func BenchmarkTruncIndexNew500(b *testing.B) {
|
||||
var testSet []string
|
||||
for i := 0; i < 500; i++ {
|
||||
testSet = append(testSet, utils.GenerateRandomID())
|
||||
testSet = append(testSet, common.GenerateRandomID())
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -334,7 +334,7 @@ func BenchmarkTruncIndexAddGet100(b *testing.B) {
|
|||
var testSet []string
|
||||
var testKeys []string
|
||||
for i := 0; i < 500; i++ {
|
||||
id := utils.GenerateRandomID()
|
||||
id := common.GenerateRandomID()
|
||||
testSet = append(testSet, id)
|
||||
l := rand.Intn(12) + 12
|
||||
testKeys = append(testKeys, id[:l])
|
||||
|
@ -359,7 +359,7 @@ func BenchmarkTruncIndexAddGet250(b *testing.B) {
|
|||
var testSet []string
|
||||
var testKeys []string
|
||||
for i := 0; i < 500; i++ {
|
||||
id := utils.GenerateRandomID()
|
||||
id := common.GenerateRandomID()
|
||||
testSet = append(testSet, id)
|
||||
l := rand.Intn(12) + 12
|
||||
testKeys = append(testKeys, id[:l])
|
||||
|
@ -384,7 +384,7 @@ func BenchmarkTruncIndexAddGet500(b *testing.B) {
|
|||
var testSet []string
|
||||
var testKeys []string
|
||||
for i := 0; i < 500; i++ {
|
||||
id := utils.GenerateRandomID()
|
||||
id := common.GenerateRandomID()
|
||||
testSet = append(testSet, id)
|
||||
l := rand.Intn(12) + 12
|
||||
testKeys = append(testKeys, id[:l])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue