Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
9423f80d
Commit
9423f80d
authored
Jun 10, 2015
by
Daniel Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test bug & conversion bug
parent
47294dd3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
+32
-12
conversion.go
pkg/api/v1/conversion.go
+1
-1
service_latency.go
test/e2e/service_latency.go
+31
-11
No files found.
pkg/api/v1/conversion.go
View file @
9423f80d
...
@@ -141,7 +141,7 @@ func addConversionFuncs() {
...
@@ -141,7 +141,7 @@ func addConversionFuncs() {
// If one of the conversion functions is malformed, detect it immediately.
// If one of the conversion functions is malformed, detect it immediately.
panic
(
err
)
panic
(
err
)
}
}
err
=
api
.
Scheme
.
AddFieldLabelConversionFunc
(
"v1
beta3
"
,
"Endpoints"
,
err
=
api
.
Scheme
.
AddFieldLabelConversionFunc
(
"v1"
,
"Endpoints"
,
func
(
label
,
value
string
)
(
string
,
string
,
error
)
{
func
(
label
,
value
string
)
(
string
,
string
,
error
)
{
switch
label
{
switch
label
{
case
"metadata.name"
:
case
"metadata.name"
:
...
...
test/e2e/service_latency.go
View file @
9423f80d
...
@@ -19,14 +19,15 @@ package e2e
...
@@ -19,14 +19,15 @@ package e2e
import
(
import
(
"fmt"
"fmt"
"sort"
"sort"
"strings"
"time"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
)
)
type
durations
[]
time
.
Duration
type
durations
[]
time
.
Duration
...
@@ -43,16 +44,32 @@ var _ = Describe("Service endpoints latency", func() {
...
@@ -43,16 +44,32 @@ var _ = Describe("Service endpoints latency", func() {
if
err
!=
nil
{
if
err
!=
nil
{
Failf
(
"Failed to list nodes: %v"
,
err
)
Failf
(
"Failed to list nodes: %v"
,
err
)
}
}
count
:=
len
(
nodes
.
Items
)
count
:=
len
(
nodes
.
Items
)
d
,
err
:=
runServiceLatencies
(
f
,
8
*
count
,
20
*
count
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// Numbers chosen to make the test complete in a short amount
// of time. This sample size is not actually large enough to
// reliably measure tails on a reasonably sized test cluster,
// but it should catch low hanging fruit.
var
(
totalTrials
=
20
*
count
parallelTrials
=
8
*
count
minSampleSize
=
10
*
count
)
failing
:=
util
.
NewStringSet
()
d
,
err
:=
runServiceLatencies
(
f
,
parallelTrials
,
totalTrials
)
if
err
!=
nil
{
failing
.
Insert
(
fmt
.
Sprintf
(
"Not all RC/pod/service trials succeeded: %v"
,
err
))
}
dSorted
:=
durations
(
d
)
dSorted
:=
durations
(
d
)
sort
.
Sort
(
dSorted
)
sort
.
Sort
(
dSorted
)
n
:=
len
(
dSorted
)
n
:=
len
(
dSorted
)
if
n
<
5
{
if
n
<
minSampleSize
{
Expect
(
fmt
.
Errorf
(
"Did not get a good enough sample size: %v"
,
dSorted
))
.
NotTo
(
HaveOccurred
())
failing
.
Insert
(
fmt
.
Sprintf
(
"Did not get a good sample size: %v"
,
dSorted
))
return
}
if
n
<
2
{
failing
.
Insert
(
"Less than two runs succeeded; aborting."
)
Fail
(
strings
.
Join
(
failing
.
List
(),
"
\n
"
))
}
}
percentile
:=
func
(
p
int
)
time
.
Duration
{
percentile
:=
func
(
p
int
)
time
.
Duration
{
est
:=
n
*
p
/
100
est
:=
n
*
p
/
100
...
@@ -70,11 +87,14 @@ var _ = Describe("Service endpoints latency", func() {
...
@@ -70,11 +87,14 @@ var _ = Describe("Service endpoints latency", func() {
Logf
(
"99 %%ile: %v"
,
p99
)
Logf
(
"99 %%ile: %v"
,
p99
)
if
p99
>
4
*
p50
{
if
p99
>
4
*
p50
{
Fail
(
"Tail latency is > 4x median latency"
)
failing
.
Insert
(
"Tail latency is > 4x median latency"
)
}
}
if
p50
>
time
.
Second
*
20
{
if
p50
>
time
.
Second
*
20
{
Fail
(
"Median latency should be less than 20 seconds"
)
failing
.
Insert
(
"Median latency should be less than 20 seconds"
)
}
if
failing
.
Len
()
>
0
{
Fail
(
strings
.
Join
(
failing
.
List
(),
"
\n
"
))
}
}
})
})
})
})
...
@@ -112,7 +132,7 @@ func runServiceLatencies(f *Framework, inParallel, total int) (output []time.Dur
...
@@ -112,7 +132,7 @@ func runServiceLatencies(f *Framework, inParallel, total int) (output []time.Dur
for
i
:=
0
;
i
<
total
;
i
++
{
for
i
:=
0
;
i
<
total
;
i
++
{
select
{
select
{
case
e
:=
<-
errs
:
case
e
:=
<-
errs
:
Expect
(
e
)
.
NotTo
(
HaveOccurred
()
)
Logf
(
"Got error: %v"
,
e
)
errCount
+=
1
errCount
+=
1
case
d
:=
<-
durations
:
case
d
:=
<-
durations
:
output
=
append
(
output
,
d
)
output
=
append
(
output
,
d
)
...
@@ -132,7 +152,7 @@ func singleServiceLatency(f *Framework, i int) (time.Duration, error) {
...
@@ -132,7 +152,7 @@ func singleServiceLatency(f *Framework, i int) (time.Duration, error) {
Name
:
fmt
.
Sprintf
(
"trial-%v"
,
i
),
Name
:
fmt
.
Sprintf
(
"trial-%v"
,
i
),
Namespace
:
f
.
Namespace
.
Name
,
Namespace
:
f
.
Namespace
.
Name
,
Replicas
:
1
,
Replicas
:
1
,
PollInterval
:
10
,
PollInterval
:
time
.
Second
,
}
}
if
err
:=
RunRC
(
cfg
);
err
!=
nil
{
if
err
:=
RunRC
(
cfg
);
err
!=
nil
{
return
0
,
err
return
0
,
err
...
...
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