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
fa30b796
Commit
fa30b796
authored
Dec 08, 2015
by
Minhan Xia
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18244 from freehan/eslogging
Increase verbosity for cluster logging e2e test
parents
90d5bc18
3e7882e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
17 deletions
+34
-17
es_cluster_logging.go
test/e2e/es_cluster_logging.go
+34
-17
No files found.
test/e2e/es_cluster_logging.go
View file @
fa30b796
...
@@ -145,6 +145,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -145,6 +145,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
// Now assume we really are talking to an Elasticsearch instance.
// Now assume we really are talking to an Elasticsearch instance.
// Check the cluster health.
// Check the cluster health.
By
(
"Checking health of Elasticsearch service."
)
By
(
"Checking health of Elasticsearch service."
)
healthy
:=
false
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
graceTime
;
time
.
Sleep
(
5
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
graceTime
;
time
.
Sleep
(
5
*
time
.
Second
)
{
body
,
err
=
f
.
Client
.
Get
()
.
body
,
err
=
f
.
Client
.
Get
()
.
Namespace
(
api
.
NamespaceSystem
)
.
Namespace
(
api
.
NamespaceSystem
)
.
...
@@ -154,21 +155,30 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -154,21 +155,30 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
Suffix
(
"_cluster/health"
)
.
Suffix
(
"_cluster/health"
)
.
Param
(
"health"
,
"pretty"
)
.
Param
(
"health"
,
"pretty"
)
.
DoRaw
()
DoRaw
()
if
err
==
nil
{
if
err
!=
nil
{
break
continue
}
}
}
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
health
,
err
:=
bodyToJSON
(
body
)
health
,
err
:=
bodyToJSON
(
body
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
if
err
!=
nil
{
continue
}
statusIntf
,
ok
:=
health
[
"status"
]
statusIntf
,
ok
:=
health
[
"status"
]
if
!
ok
{
if
!
ok
{
Failf
(
"No status field found in cluster health response: %v"
,
health
)
Logf
(
"No status field found in cluster health response: %v"
,
health
)
continue
}
}
status
:=
statusIntf
.
(
string
)
status
:=
statusIntf
.
(
string
)
if
status
!=
"green"
&&
status
!=
"yellow"
{
if
status
!=
"green"
&&
status
!=
"yellow"
{
Failf
(
"Cluster health has bad status: %s"
,
status
)
Logf
(
"Cluster health has bad status: %s"
,
status
)
continue
}
if
err
==
nil
&&
ok
{
healthy
=
true
break
}
}
if
!
healthy
{
Failf
(
"After %v elasticsearch cluster is not healthy"
,
graceTime
)
}
}
// Obtain a list of nodes so we can place one synthetic logger on each node.
// Obtain a list of nodes so we can place one synthetic logger on each node.
...
@@ -201,7 +211,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -201,7 +211,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
// Form a unique name to taint log lines to be collected.
// Form a unique name to taint log lines to be collected.
// Replace '-' characters with '_' to prevent the analyzer from breaking apart names.
// Replace '-' characters with '_' to prevent the analyzer from breaking apart names.
taintName
:=
strings
.
Replace
(
ns
+
name
,
"-"
,
"_"
,
-
1
)
taintName
:=
strings
.
Replace
(
ns
+
name
,
"-"
,
"_"
,
-
1
)
Logf
(
"Tainting log lines with %v"
,
taintName
)
// podNames records the names of the synthetic logging pods that are created in the
// podNames records the names of the synthetic logging pods that are created in the
// loop below.
// loop below.
var
podNames
[]
string
var
podNames
[]
string
...
@@ -253,8 +263,9 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -253,8 +263,9 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
// Make several attempts to observe the logs ingested into Elasticsearch.
// Make several attempts to observe the logs ingested into Elasticsearch.
By
(
"Checking all the log lines were ingested into Elasticsearch"
)
By
(
"Checking all the log lines were ingested into Elasticsearch"
)
m
issing
:=
0
totalM
issing
:=
0
expected
:=
nodeCount
*
countTo
expected
:=
nodeCount
*
countTo
missingPerNode
:=
[]
int
{}
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
ingestionTimeout
;
time
.
Sleep
(
10
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
ingestionTimeout
;
time
.
Sleep
(
10
*
time
.
Second
)
{
// Debugging code to report the status of the elasticsearch logging endpoints.
// Debugging code to report the status of the elasticsearch logging endpoints.
...
@@ -304,9 +315,8 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -304,9 +315,8 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
continue
continue
}
}
total
:=
int
(
totalF
)
total
:=
int
(
totalF
)
if
total
<
expected
{
if
total
!=
expected
{
Logf
(
"After %v expecting to find %d log lines but saw only %d"
,
time
.
Since
(
start
),
expected
,
total
)
Logf
(
"After %v expecting to find %d log lines but saw %d"
,
time
.
Since
(
start
),
expected
,
total
)
continue
}
}
h
,
ok
:=
hits
[
"hits"
]
.
([]
interface
{})
h
,
ok
:=
hits
[
"hits"
]
.
([]
interface
{})
if
!
ok
{
if
!
ok
{
...
@@ -354,23 +364,30 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -354,23 +364,30 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
observed
[
n
][
index
]
++
observed
[
n
][
index
]
++
}
}
// Make sure we correctly observed the expected log lines from each node.
// Make sure we correctly observed the expected log lines from each node.
missing
=
0
totalMissing
=
0
missingPerNode
=
make
([]
int
,
nodeCount
)
for
n
:=
range
observed
{
for
n
:=
range
observed
{
for
i
,
c
:=
range
observed
[
n
]
{
for
i
,
c
:=
range
observed
[
n
]
{
if
c
==
0
{
if
c
==
0
{
missing
++
totalMissing
++
missingPerNode
[
n
]
++
}
}
if
c
<
0
||
c
>
1
{
if
c
<
0
||
c
>
1
{
Failf
(
"Got incorrect count for node %d index %d: %d"
,
n
,
i
,
c
)
Failf
(
"Got incorrect count for node %d index %d: %d"
,
n
,
i
,
c
)
}
}
}
}
}
}
if
m
issing
!=
0
{
if
totalM
issing
!=
0
{
Logf
(
"After %v still missing %d log lines"
,
time
.
Since
(
start
),
m
issing
)
Logf
(
"After %v still missing %d log lines"
,
time
.
Since
(
start
),
totalM
issing
)
continue
continue
}
}
Logf
(
"After %s found all %d log lines"
,
time
.
Since
(
start
),
expected
)
Logf
(
"After %s found all %d log lines"
,
time
.
Since
(
start
),
expected
)
return
return
}
}
for
n
:=
range
missingPerNode
{
if
missingPerNode
[
n
]
>
0
{
Logf
(
"Node %d is missing %d logs"
,
n
,
missingPerNode
[
n
])
}
}
Failf
(
"Failed to find all %d log lines"
,
expected
)
Failf
(
"Failed to find all %d log lines"
,
expected
)
}
}
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