Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
72133789
Commit
72133789
authored
Dec 17, 2019
by
Adrien Kohlbecker
Committed by
Michael Kozono
Dec 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timestamps to pod logs
parent
1ccc1230
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
125 additions
and
50 deletions
+125
-50
changelogs/unreleased/ak-logs-timestamp.yml
changelogs/unreleased/ak-logs-timestamp.yml
+5
-0
ee/app/assets/javascripts/logs/stores/getters.js
ee/app/assets/javascripts/logs/stores/getters.js
+6
-1
ee/app/models/ee/clusters/platforms/kubernetes.rb
ee/app/models/ee/clusters/platforms/kubernetes.rb
+10
-2
ee/lib/gitlab/elasticsearch/logs.rb
ee/lib/gitlab/elasticsearch/logs.rb
+8
-3
ee/spec/features/projects/environments_pod_logs_spec.rb
ee/spec/features/projects/environments_pod_logs_spec.rb
+1
-1
ee/spec/fixtures/lib/elasticsearch/logs_response.json
ee/spec/fixtures/lib/elasticsearch/logs_response.json
+8
-4
ee/spec/frontend/logs/components/environment_logs_spec.js
ee/spec/frontend/logs/components/environment_logs_spec.js
+6
-5
ee/spec/frontend/logs/mock_data.js
ee/spec/frontend/logs/mock_data.js
+53
-15
ee/spec/frontend/logs/stores/actions_spec.js
ee/spec/frontend/logs/stores/actions_spec.js
+5
-5
ee/spec/frontend/logs/stores/getters_spec.js
ee/spec/frontend/logs/stores/getters_spec.js
+3
-3
ee/spec/frontend/logs/stores/mutations_spec.js
ee/spec/frontend/logs/stores/mutations_spec.js
+3
-3
ee/spec/lib/gitlab/elasticsearch/logs_spec.rb
ee/spec/lib/gitlab/elasticsearch/logs_spec.rb
+6
-4
ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb
ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb
+9
-2
spec/support/helpers/kubernetes_helpers.rb
spec/support/helpers/kubernetes_helpers.rb
+2
-2
No files found.
changelogs/unreleased/ak-logs-timestamp.yml
0 → 100644
View file @
72133789
---
title
:
Add timestamps to pod logs
merge_request
:
21663
author
:
type
:
added
ee/app/assets/javascripts/logs/stores/getters.js
View file @
72133789
export
const
trace
=
state
=>
state
.
logs
.
lines
.
join
(
'
\n
'
);
import
dateFormat
from
'
dateformat
'
;
export
const
trace
=
state
=>
state
.
logs
.
lines
.
map
(
item
=>
[
dateFormat
(
item
.
timestamp
,
'
UTC:mmm dd HH:MM:ss.l"Z"
'
),
item
.
message
].
join
(
'
|
'
))
.
join
(
'
\n
'
);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
ee/app/models/ee/clusters/platforms/kubernetes.rb
View file @
72133789
...
...
@@ -99,10 +99,18 @@ module EE
def
platform_pod_logs
(
namespace
,
pod_name
,
container_name
)
logs
=
kubeclient
.
get_pod_log
(
pod_name
,
namespace
,
container:
container_name
,
tail_lines:
LOGS_LIMIT
pod_name
,
namespace
,
container:
container_name
,
tail_lines:
LOGS_LIMIT
,
timestamps:
true
).
body
logs
.
strip
.
split
(
"
\n
"
)
logs
.
strip
.
split
(
"
\n
"
).
map
do
|
line
|
# message contains a RFC3339Nano timestamp, then a space, then the log line.
# resolution of the nanoseconds can vary, so we split on the first space
values
=
line
.
split
(
' '
,
2
)
{
timestamp:
values
[
0
],
message:
values
[
1
]
}
end
end
def
elastic_stack_pod_logs
(
namespace
,
pod_name
,
container_name
)
...
...
ee/lib/gitlab/elasticsearch/logs.rb
View file @
72133789
...
...
@@ -51,14 +51,19 @@ module Gitlab
{
"@timestamp"
:
{
order: :desc
}
},
{
"offset"
:
{
order: :desc
}
}
],
# only return the
message field
in the response
_source:
[
"message"
],
# only return the
se fields
in the response
_source:
[
"
@timestamp"
,
"
message"
],
# fixed limit for now, we should support paginated queries
size:
::
Gitlab
::
Elasticsearch
::
Logs
::
LOGS_LIMIT
}
response
=
@client
.
search
body:
body
result
=
response
.
fetch
(
"hits"
,
{}).
fetch
(
"hits"
,
[]).
map
{
|
h
|
h
[
"_source"
][
"message"
]
}
result
=
response
.
fetch
(
"hits"
,
{}).
fetch
(
"hits"
,
[]).
map
do
|
hit
|
{
timestamp:
hit
[
"_source"
][
"@timestamp"
],
message:
hit
[
"_source"
][
"message"
]
}
end
# we queried for the N-most recent records but we want them ordered oldest to newest
result
.
reverse
...
...
ee/spec/features/projects/environments_pod_logs_spec.rb
View file @
72133789
...
...
@@ -70,7 +70,7 @@ describe 'Environment > Pod Logs', :js do
expect
(
item
.
text
).
to
eq
(
pod_names
[
i
])
end
end
expect
(
page
).
to
have_content
(
"
Log 1 Log 2
Log 3"
)
expect
(
page
).
to
have_content
(
"
Dec 13 14:04:22.123Z | Log 1 Dec 13 14:04:23.123Z | Log 2 Dec 13 14:04:24.123Z |
Log 3"
)
end
end
...
...
ee/spec/fixtures/lib/elasticsearch/logs_response.json
View file @
72133789
...
...
@@ -18,7 +18,8 @@
"_id"
:
"SkbxAW4BWzhswgK-C5-R"
,
"_score"
:
null
,
"_source"
:
{
"message"
:
"10.8.2.1 - - [25/Oct/2019:08:03:22 UTC]
\"
GET / HTTP/1.1
\"
200 13"
"message"
:
"10.8.2.1 - - [25/Oct/2019:08:03:22 UTC]
\"
GET / HTTP/1.1
\"
200 13"
,
"@timestamp"
:
"2019-12-13T14:35:34.034Z"
},
"sort"
:
[
9999998
,
...
...
@@ -31,7 +32,8 @@
"_id"
:
"wEigD24BWzhswgK-WUU2"
,
"_score"
:
null
,
"_source"
:
{
"message"
:
"10.8.2.1 - - [27/Oct/2019:23:49:54 UTC]
\"
GET / HTTP/1.1
\"
200 13"
"message"
:
"10.8.2.1 - - [27/Oct/2019:23:49:54 UTC]
\"
GET / HTTP/1.1
\"
200 13"
,
"@timestamp"
:
"2019-12-13T14:35:35.034Z"
},
"sort"
:
[
9999949
,
...
...
@@ -44,7 +46,8 @@
"_id"
:
"gE6uOG4BWzhswgK-M0x2"
,
"_score"
:
null
,
"_source"
:
{
"message"
:
"10.8.2.1 - - [04/Nov/2019:23:09:24 UTC]
\"
GET / HTTP/1.1
\"
200 13"
"message"
:
"10.8.2.1 - - [04/Nov/2019:23:09:24 UTC]
\"
GET / HTTP/1.1
\"
200 13"
,
"@timestamp"
:
"2019-12-13T14:35:36.034Z"
},
"sort"
:
[
9999944
,
...
...
@@ -57,7 +60,8 @@
"_id"
:
"0klPHW4BWzhswgK-nfCF"
,
"_score"
:
null
,
"_source"
:
{
"message"
:
"- -
\u
003e /"
"message"
:
"- -
\u
003e /"
,
"@timestamp"
:
"2019-12-13T14:35:37.034Z"
},
"sort"
:
[
9999934
,
...
...
ee/spec/frontend/logs/components/environment_logs_spec.js
View file @
72133789
...
...
@@ -10,7 +10,8 @@ import {
mockEnvName
,
mockEnvironments
,
mockPods
,
mockLines
,
mockLogsResult
,
mockTrace
,
mockPodName
,
mockEnvironmentsEndpoint
,
}
from
'
../mock_data
'
;
...
...
@@ -152,14 +153,14 @@ describe('EnvironmentLogs', () => {
[
state
.
pods
.
current
]
=
state
.
pods
.
options
;
state
.
logs
.
isComplete
=
false
;
state
.
logs
.
lines
=
mockL
ines
;
state
.
logs
.
lines
=
mockL
ogsResult
;
});
actionMocks
.
showPodLogs
.
mockImplementation
(
podName
=>
{
state
.
pods
.
options
=
mockPods
;
[
state
.
pods
.
current
]
=
podName
;
state
.
logs
.
isComplete
=
false
;
state
.
logs
.
lines
=
mockL
ines
;
state
.
logs
.
lines
=
mockL
ogsResult
;
});
actionMocks
.
fetchEnvironments
.
mockImplementation
(()
=>
{
state
.
environments
.
options
=
mockEnvironments
;
...
...
@@ -200,8 +201,8 @@ describe('EnvironmentLogs', () => {
it
(
'
populates logs trace
'
,
()
=>
{
const
trace
=
findLogTrace
();
expect
(
trace
.
text
().
split
(
'
\n
'
).
length
).
toBe
(
mock
Lines
.
length
);
expect
(
trace
.
text
().
split
(
'
\n
'
)).
toEqual
(
mock
Lines
);
expect
(
trace
.
text
().
split
(
'
\n
'
).
length
).
toBe
(
mock
Trace
.
length
);
expect
(
trace
.
text
().
split
(
'
\n
'
)).
toEqual
(
mock
Trace
);
});
it
(
'
update control buttons state
'
,
()
=>
{
...
...
ee/spec/frontend/logs/mock_data.js
View file @
72133789
...
...
@@ -24,19 +24,57 @@ export const mockPods = [
'
production-764c58d697-ddddd
'
,
];
export
const
mockLines
=
[
'
10.36.0.1 - - [16/Oct/2019:06:29:48 UTC] "GET / HTTP/1.1" 200 13
'
,
'
- -> /
'
,
'
10.36.0.1 - - [16/Oct/2019:06:29:57 UTC] "GET / HTTP/1.1" 200 13
'
,
'
- -> /
'
,
'
10.36.0.1 - - [16/Oct/2019:06:29:58 UTC] "GET / HTTP/1.1" 200 13
'
,
'
- -> /
'
,
'
10.36.0.1 - - [16/Oct/2019:06:30:07 UTC] "GET / HTTP/1.1" 200 13
'
,
'
- -> /
'
,
'
10.36.0.1 - - [16/Oct/2019:06:30:08 UTC] "GET / HTTP/1.1" 200 13
'
,
'
- -> /
'
,
'
10.36.0.1 - - [16/Oct/2019:06:30:17 UTC] "GET / HTTP/1.1" 200 13
'
,
'
- -> /
'
,
'
10.36.0.1 - - [16/Oct/2019:06:30:18 UTC] "GET / HTTP/1.1" 200 13
'
,
'
- -> /
'
,
export
const
mockLogsResult
=
[
{
timestamp
:
'
2019-12-13T13:43:18.2760123Z
'
,
message
:
'
10.36.0.1 - - [16/Oct/2019:06:29:48 UTC] "GET / HTTP/1.1" 200 13
'
,
},
{
timestamp
:
'
2019-12-13T13:43:18.2760123Z
'
,
message
:
'
- -> /
'
},
{
timestamp
:
'
2019-12-13T13:43:26.8420123Z
'
,
message
:
'
10.36.0.1 - - [16/Oct/2019:06:29:57 UTC] "GET / HTTP/1.1" 200 13
'
,
},
{
timestamp
:
'
2019-12-13T13:43:26.8420123Z
'
,
message
:
'
- -> /
'
},
{
timestamp
:
'
2019-12-13T13:43:28.3710123Z
'
,
message
:
'
10.36.0.1 - - [16/Oct/2019:06:29:58 UTC] "GET / HTTP/1.1" 200 13
'
,
},
{
timestamp
:
'
2019-12-13T13:43:28.3710123Z
'
,
message
:
'
- -> /
'
},
{
timestamp
:
'
2019-12-13T13:43:36.8860123Z
'
,
message
:
'
10.36.0.1 - - [16/Oct/2019:06:30:07 UTC] "GET / HTTP/1.1" 200 13
'
,
},
{
timestamp
:
'
2019-12-13T13:43:36.8860123Z
'
,
message
:
'
- -> /
'
},
{
timestamp
:
'
2019-12-13T13:43:38.4000123Z
'
,
message
:
'
10.36.0.1 - - [16/Oct/2019:06:30:08 UTC] "GET / HTTP/1.1" 200 13
'
,
},
{
timestamp
:
'
2019-12-13T13:43:38.4000123Z
'
,
message
:
'
- -> /
'
},
{
timestamp
:
'
2019-12-13T13:43:46.8420123Z
'
,
message
:
'
10.36.0.1 - - [16/Oct/2019:06:30:17 UTC] "GET / HTTP/1.1" 200 13
'
,
},
{
timestamp
:
'
2019-12-13T13:43:46.8430123Z
'
,
message
:
'
- -> /
'
},
{
timestamp
:
'
2019-12-13T13:43:48.3240123Z
'
,
message
:
'
10.36.0.1 - - [16/Oct/2019:06:30:18 UTC] "GET / HTTP/1.1" 200 13
'
,
},
{
timestamp
:
'
2019-12-13T13:43:48.3250123Z
'
,
message
:
'
- -> /
'
},
];
export
const
mockTrace
=
[
'
Dec 13 13:43:18.276Z | 10.36.0.1 - - [16/Oct/2019:06:29:48 UTC] "GET / HTTP/1.1" 200 13
'
,
'
Dec 13 13:43:18.276Z | - -> /
'
,
'
Dec 13 13:43:26.842Z | 10.36.0.1 - - [16/Oct/2019:06:29:57 UTC] "GET / HTTP/1.1" 200 13
'
,
'
Dec 13 13:43:26.842Z | - -> /
'
,
'
Dec 13 13:43:28.371Z | 10.36.0.1 - - [16/Oct/2019:06:29:58 UTC] "GET / HTTP/1.1" 200 13
'
,
'
Dec 13 13:43:28.371Z | - -> /
'
,
'
Dec 13 13:43:36.886Z | 10.36.0.1 - - [16/Oct/2019:06:30:07 UTC] "GET / HTTP/1.1" 200 13
'
,
'
Dec 13 13:43:36.886Z | - -> /
'
,
'
Dec 13 13:43:38.400Z | 10.36.0.1 - - [16/Oct/2019:06:30:08 UTC] "GET / HTTP/1.1" 200 13
'
,
'
Dec 13 13:43:38.400Z | - -> /
'
,
'
Dec 13 13:43:46.842Z | 10.36.0.1 - - [16/Oct/2019:06:30:17 UTC] "GET / HTTP/1.1" 200 13
'
,
'
Dec 13 13:43:46.843Z | - -> /
'
,
'
Dec 13 13:43:48.324Z | 10.36.0.1 - - [16/Oct/2019:06:30:18 UTC] "GET / HTTP/1.1" 200 13
'
,
'
Dec 13 13:43:48.325Z | - -> /
'
,
];
ee/spec/frontend/logs/stores/actions_spec.js
View file @
72133789
...
...
@@ -14,7 +14,7 @@ import {
mockEnvironmentsEndpoint
,
mockEnvironments
,
mockPods
,
mockL
ines
,
mockL
ogsResult
,
mockEnvName
,
}
from
'
../mock_data
'
;
...
...
@@ -122,7 +122,7 @@ describe('Logs Store actions', () => {
.
reply
(
200
,
{
pod_name
:
mockPodName
,
pods
:
mockPods
,
logs
:
mockL
ines
,
logs
:
mockL
ogsResult
,
});
mock
.
onGet
(
endpoint
).
replyOnce
(
202
);
// mock reactive cache
...
...
@@ -136,7 +136,7 @@ describe('Logs Store actions', () => {
{
type
:
types
.
REQUEST_LOGS_DATA
},
{
type
:
types
.
SET_CURRENT_POD_NAME
,
payload
:
mockPodName
},
{
type
:
types
.
RECEIVE_PODS_DATA_SUCCESS
,
payload
:
mockPods
},
{
type
:
types
.
RECEIVE_LOGS_DATA_SUCCESS
,
payload
:
mockL
ines
},
{
type
:
types
.
RECEIVE_LOGS_DATA_SUCCESS
,
payload
:
mockL
ogsResult
},
],
[],
done
,
...
...
@@ -152,7 +152,7 @@ describe('Logs Store actions', () => {
mock
.
onGet
(
endpoint
,
{
params
:
{
environment_name
:
mockEnvName
}
}).
reply
(
200
,
{
pod_name
:
mockPodName
,
pods
:
mockPods
,
logs
:
mockL
ines
,
logs
:
mockL
ogsResult
,
});
mock
.
onGet
(
endpoint
).
replyOnce
(
202
);
// mock reactive cache
...
...
@@ -165,7 +165,7 @@ describe('Logs Store actions', () => {
{
type
:
types
.
REQUEST_LOGS_DATA
},
{
type
:
types
.
SET_CURRENT_POD_NAME
,
payload
:
mockPodName
},
{
type
:
types
.
RECEIVE_PODS_DATA_SUCCESS
,
payload
:
mockPods
},
{
type
:
types
.
RECEIVE_LOGS_DATA_SUCCESS
,
payload
:
mockL
ines
},
{
type
:
types
.
RECEIVE_LOGS_DATA_SUCCESS
,
payload
:
mockL
ogsResult
},
],
[],
done
,
...
...
ee/spec/frontend/logs/stores/getters_spec.js
View file @
72133789
import
*
as
getters
from
'
ee/logs/stores/getters
'
;
import
logsPageState
from
'
ee/logs/stores/state
'
;
import
{
mockL
ines
}
from
'
../mock_data
'
;
import
{
mockL
ogsResult
,
mockTrace
}
from
'
../mock_data
'
;
describe
(
'
Logs Store getters
'
,
()
=>
{
let
state
;
...
...
@@ -29,11 +29,11 @@ describe('Logs Store getters', () => {
describe
(
'
when state logs are set
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
logs
.
lines
=
mockL
ines
;
state
.
logs
.
lines
=
mockL
ogsResult
;
});
it
(
'
returns an empty string
'
,
()
=>
{
expect
(
getters
.
trace
(
state
)).
toEqual
(
mock
Lines
.
join
(
'
\n
'
));
expect
(
getters
.
trace
(
state
)).
toEqual
(
mock
Trace
.
join
(
'
\n
'
));
});
});
});
...
...
ee/spec/frontend/logs/stores/mutations_spec.js
View file @
72133789
...
...
@@ -8,7 +8,7 @@ import {
mockEnvironments
,
mockPods
,
mockPodName
,
mockL
ines
,
mockL
ogsResult
,
}
from
'
../mock_data
'
;
describe
(
'
Logs Store Mutations
'
,
()
=>
{
...
...
@@ -83,11 +83,11 @@ describe('Logs Store Mutations', () => {
describe
(
'
RECEIVE_LOGS_DATA_SUCCESS
'
,
()
=>
{
it
(
'
receives logs lines
'
,
()
=>
{
mutations
[
types
.
RECEIVE_LOGS_DATA_SUCCESS
](
state
,
mockL
ines
);
mutations
[
types
.
RECEIVE_LOGS_DATA_SUCCESS
](
state
,
mockL
ogsResult
);
expect
(
state
.
logs
).
toEqual
(
expect
.
objectContaining
({
lines
:
mockL
ines
,
lines
:
mockL
ogsResult
,
isLoading
:
false
,
isComplete
:
true
,
}),
...
...
ee/spec/lib/gitlab/elasticsearch/logs_spec.rb
View file @
72133789
...
...
@@ -5,10 +5,10 @@ require 'spec_helper'
describe
Gitlab
::
Elasticsearch
::
Logs
do
let
(
:client
)
{
Elasticsearch
::
Transport
::
Client
}
let
(
:es_message_1
)
{
"10.8.2.1 - - [25/Oct/2019:08:03:22 UTC]
\"
GET / HTTP/1.1
\"
200 13"
}
let
(
:es_message_2
)
{
"10.8.2.1 - - [27/Oct/2019:23:49:54 UTC]
\"
GET / HTTP/1.1
\"
200 13"
}
let
(
:es_message_3
)
{
"10.8.2.1 - - [04/Nov/2019:23:09:24 UTC]
\"
GET / HTTP/1.1
\"
200 13"
}
let
(
:es_message_4
)
{
"- -
\u
003e /"
}
let
(
:es_message_1
)
{
{
timestamp:
"2019-12-13T14:35:34.034Z"
,
message:
"10.8.2.1 - - [25/Oct/2019:08:03:22 UTC]
\"
GET / HTTP/1.1
\"
200 13"
}
}
let
(
:es_message_2
)
{
{
timestamp:
"2019-12-13T14:35:35.034Z"
,
message:
"10.8.2.1 - - [27/Oct/2019:23:49:54 UTC]
\"
GET / HTTP/1.1
\"
200 13"
}
}
let
(
:es_message_3
)
{
{
timestamp:
"2019-12-13T14:35:36.034Z"
,
message:
"10.8.2.1 - - [04/Nov/2019:23:09:24 UTC]
\"
GET / HTTP/1.1
\"
200 13"
}
}
let
(
:es_message_4
)
{
{
timestamp:
"2019-12-13T14:35:37.034Z"
,
message:
"- -
\u
003e /"
}
}
let
(
:es_response
)
{
JSON
.
parse
(
fixture_file
(
'lib/elasticsearch/logs_response.json'
,
dir:
'ee'
))
}
...
...
@@ -53,6 +53,7 @@ describe Gitlab::Elasticsearch::Logs do
}
],
_source:
[
"@timestamp"
,
"message"
],
size:
500
...
...
@@ -101,6 +102,7 @@ describe Gitlab::Elasticsearch::Logs do
}
],
_source:
[
"@timestamp"
,
"message"
],
size:
500
...
...
ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb
View file @
72133789
...
...
@@ -141,12 +141,19 @@ describe Clusters::Platforms::Kubernetes do
let
(
:pod_name
)
{
'pod-1'
}
let
(
:namespace
)
{
'app'
}
let
(
:container
)
{
'some-container'
}
let
(
:expected_logs
)
do
[
{
message:
"Log 1"
,
timestamp:
"2019-12-13T14:04:22.123456Z"
},
{
message:
"Log 2"
,
timestamp:
"2019-12-13T14:04:23.123456Z"
},
{
message:
"Log 3"
,
timestamp:
"2019-12-13T14:04:24.123456Z"
}
]
end
subject
{
service
.
read_pod_logs
(
environment
.
id
,
pod_name
,
namespace
,
container:
container
)
}
shared_examples
'successful log request'
do
it
do
expect
(
subject
[
:logs
]).
to
eq
(
[
"Log 1"
,
"Log 2"
,
"Log 3"
]
)
expect
(
subject
[
:logs
]).
to
eq
(
expected_logs
)
expect
(
subject
[
:status
]).
to
eq
(
:success
)
expect
(
subject
[
:pod_name
]).
to
eq
(
pod_name
)
expect
(
subject
[
:container_name
]).
to
eq
(
container
)
...
...
@@ -171,7 +178,7 @@ describe Clusters::Platforms::Kubernetes do
before
do
expect_any_instance_of
(
::
Clusters
::
Applications
::
ElasticStack
).
to
receive
(
:elasticsearch_client
).
at_least
(
:once
).
and_return
(
Elasticsearch
::
Transport
::
Client
.
new
)
expect_any_instance_of
(
::
Gitlab
::
Elasticsearch
::
Logs
).
to
receive
(
:pod_logs
).
and_return
(
[
"Log 1"
,
"Log 2"
,
"Log 3"
]
)
expect_any_instance_of
(
::
Gitlab
::
Elasticsearch
::
Logs
).
to
receive
(
:pod_logs
).
and_return
(
expected_logs
)
stub_feature_flags
(
enable_cluster_application_elastic_stack:
true
)
end
...
...
spec/support/helpers/kubernetes_helpers.rb
View file @
72133789
...
...
@@ -84,7 +84,7 @@ module KubernetesHelpers
end
logs_url
=
service
.
api_url
+
"/api/v1/namespaces/
#{
namespace
}
/pods/
#{
pod_name
}
"
\
"/log?
#{
container_query_param
}
tailLines=
#{
Clusters
::
Platforms
::
Kubernetes
::
LOGS_LIMIT
}
"
"/log?
#{
container_query_param
}
tailLines=
#{
Clusters
::
Platforms
::
Kubernetes
::
LOGS_LIMIT
}
×tamps=true
"
if
status
response
=
{
status:
status
}
...
...
@@ -331,7 +331,7 @@ module KubernetesHelpers
end
def
kube_logs_body
"
Log 1
\n
Log 2
\n
Log 3"
"
2019-12-13T14:04:22.123456Z Log 1
\n
2019-12-13T14:04:23.123456Z Log 2
\n
2019-12-13T14:04:24.123456Z
Log 3"
end
def
kube_deployments_body
...
...
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