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
52461b77
Commit
52461b77
authored
Jun 23, 2015
by
Satnam Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retry Elasticsearch logging health check
parent
cb9f7d17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
es_cluster_logging.go
test/e2e/es_cluster_logging.go
+21
-10
No files found.
test/e2e/es_cluster_logging.go
View file @
52461b77
...
@@ -63,13 +63,18 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -63,13 +63,18 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
return
return
}
}
// graceTime is how long to keep retrying requests for status information.
const
graceTime
=
2
*
time
.
Minute
// ingestionTimeout is how long to keep retrying to wait for all the
// logs to be ingested.
const
ingestionTimeout
=
3
*
time
.
Minute
// Check for the existence of the Elasticsearch service.
// Check for the existence of the Elasticsearch service.
By
(
"Checking the Elasticsearch service exists."
)
By
(
"Checking the Elasticsearch service exists."
)
s
:=
f
.
Client
.
Services
(
api
.
NamespaceDefault
)
s
:=
f
.
Client
.
Services
(
api
.
NamespaceDefault
)
// Make a few attempts to connect. This makes the test robust against
// Make a few attempts to connect. This makes the test robust against
// being run as the first e2e test just after the e2e cluster has been created.
// being run as the first e2e test just after the e2e cluster has been created.
var
err
error
var
err
error
const
graceTime
=
10
*
time
.
Minute
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
)
{
if
_
,
err
=
s
.
Get
(
"elasticsearch-logging"
);
err
==
nil
{
if
_
,
err
=
s
.
Get
(
"elasticsearch-logging"
);
err
==
nil
{
break
break
...
@@ -139,14 +144,20 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -139,14 +144,20 @@ 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."
)
body
,
err
:=
f
.
Client
.
Get
()
.
var
body
[]
byte
Namespace
(
api
.
NamespaceDefault
)
.
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
graceTime
;
time
.
Sleep
(
5
*
time
.
Second
)
{
Prefix
(
"proxy"
)
.
body
,
err
=
f
.
Client
.
Get
()
.
Resource
(
"services"
)
.
Namespace
(
api
.
NamespaceDefault
)
.
Name
(
"elasticsearch-logging"
)
.
Prefix
(
"proxy"
)
.
Suffix
(
"_cluster/health"
)
.
Resource
(
"services"
)
.
Param
(
"health"
,
"pretty"
)
.
Name
(
"elasticsearch-logging"
)
.
DoRaw
()
Suffix
(
"_cluster/health"
)
.
Param
(
"health"
,
"pretty"
)
.
DoRaw
()
if
err
==
nil
{
break
}
}
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
health
,
err
:=
bodyToJSON
(
body
)
health
,
err
:=
bodyToJSON
(
body
)
...
@@ -244,7 +255,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -244,7 +255,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
By
(
"Checking all the log lines were ingested into Elasticsearch"
)
By
(
"Checking all the log lines were ingested into Elasticsearch"
)
missing
:=
0
missing
:=
0
expected
:=
nodeCount
*
countTo
expected
:=
nodeCount
*
countTo
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
graceTime
;
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.
esPods
,
err
:=
f
.
Client
.
Pods
(
api
.
NamespaceDefault
)
.
List
(
labels
.
Set
{
esKey
:
esValue
}
.
AsSelector
(),
fields
.
Everything
())
esPods
,
err
:=
f
.
Client
.
Pods
(
api
.
NamespaceDefault
)
.
List
(
labels
.
Set
{
esKey
:
esValue
}
.
AsSelector
(),
fields
.
Everything
())
...
...
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