Skip to content

Commit 21be449

Browse files
committed
Merge branch 'master' into apm-ui-e2e-tests
2 parents 094be3c + dd605c4 commit 21be449

1,690 files changed

Lines changed: 36313 additions & 26071 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/pipeline-library/src/test/KibanaBasePipelineTest.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class KibanaBasePipelineTest extends BasePipelineTest {
7878
return helper.callStack.find { it.methodName == name }
7979
}
8080

81+
def fnMocks(String name) {
82+
helper.callStack.findAll { it.methodName == name }
83+
}
84+
8185
void mockFailureBuild() {
8286
props([
8387
buildUtils: [

.ci/pipeline-library/src/test/slackNotifications.groovy

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,67 @@ class SlackNotificationsTest extends KibanaBasePipelineTest {
5959
args.blocks[2].text.text.toString()
6060
)
6161
}
62+
63+
@Test
64+
void 'sendFailedBuild() should call slackSend() with a backup message when first attempt fails'() {
65+
mockFailureBuild()
66+
def counter = 0
67+
helper.registerAllowedMethod('slackSend', [Map.class], { ++counter > 1 })
68+
slackNotifications.sendFailedBuild()
69+
70+
def args = fnMocks('slackSend')[1].args[0]
71+
72+
def expected = [
73+
channel: '#kibana-operations-alerts',
74+
username: 'Kibana Operations',
75+
iconEmoji: ':jenkins:',
76+
color: 'danger',
77+
message: ':broken_heart: elastic / kibana # master #1',
78+
]
79+
80+
expected.each {
81+
assertEquals(it.value.toString(), args[it.key].toString())
82+
}
83+
84+
assertEquals(
85+
":broken_heart: *<http://jenkins.localhost:8080/job/elastic+kibana+master/1/|elastic / kibana # master #1>*" +
86+
"\n\nFirst attempt at sending this notification failed. Please check the build.",
87+
args.blocks[0].text.text.toString()
88+
)
89+
}
90+
91+
@Test
92+
void 'getTestFailures() should truncate list of failures to 10'() {
93+
prop('testUtils', [
94+
getFailures: {
95+
return (1..12).collect {
96+
return [
97+
url: Mocks.TEST_FAILURE_URL,
98+
fullDisplayName: "Failure #${it}",
99+
]
100+
}
101+
},
102+
])
103+
104+
def message = (String) slackNotifications.getTestFailures()
105+
106+
assertTrue("Message ends with truncated indicator", message.endsWith("...and 2 more"))
107+
assertTrue("Message contains Failure #10", message.contains("Failure #10"))
108+
assertTrue("Message does not contain Failure #11", !message.contains("Failure #11"))
109+
}
110+
111+
@Test
112+
void 'shortenMessage() should truncate a long message, but leave parts that fit'() {
113+
assertEquals('Hello\nHello\n[...truncated...]', slackNotifications.shortenMessage('Hello\nHello\nthis is a long string', 29))
114+
}
115+
116+
@Test
117+
void 'shortenMessage() should not modify a short message'() {
118+
assertEquals('Hello world', slackNotifications.shortenMessage('Hello world', 11))
119+
}
120+
121+
@Test
122+
void 'shortenMessage() should truncate an entire message with only one part'() {
123+
assertEquals('[...truncated...]', slackNotifications.shortenMessage('Hello world this is a really long message', 40))
124+
}
62125
}

.eslintrc.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -771,19 +771,22 @@ module.exports = {
771771
},
772772

773773
/**
774-
* APM overrides
774+
* APM and Observability overrides
775775
*/
776776
{
777-
files: ['x-pack/plugins/apm/**/*.js'],
777+
files: [
778+
'x-pack/plugins/apm/**/*.{js,mjs,ts,tsx}',
779+
'x-pack/plugins/observability/**/*.{js,mjs,ts,tsx}',
780+
],
778781
rules: {
779-
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
780782
'no-console': ['warn', { allow: ['error'] }],
781-
},
782-
},
783-
{
784-
plugins: ['react-hooks'],
785-
files: ['x-pack/plugins/apm/**/*.{ts,tsx}'],
786-
rules: {
783+
'react/function-component-definition': [
784+
'warn',
785+
{
786+
namedComponents: 'function-declaration',
787+
unnamedComponents: 'arrow-function',
788+
},
789+
],
787790
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
788791
'react-hooks/exhaustive-deps': ['error', { additionalHooks: '^useFetcher$' }],
789792
},

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ kibanaPipeline(timeoutMinutes: 155, checkPrChanges: true, setCommitStatus: true)
4343
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
4444
'xpack-savedObjectsFieldMetrics': kibanaPipeline.functionalTestProcess('xpack-savedObjectsFieldMetrics', './test/scripts/jenkins_xpack_saved_objects_field_metrics.sh'),
4545
'xpack-securitySolutionCypress': { processNumber ->
46-
whenChanged(['x-pack/plugins/security_solution/', 'x-pack/test/security_solution_cypress/']) {
46+
whenChanged(['x-pack/plugins/security_solution/', 'x-pack/test/security_solution_cypress/', 'x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/', 'x-pack/plugins/triggers_actions_ui/public/application/context/actions_connectors_context.tsx']) {
4747
kibanaPipeline.functionalTestProcess('xpack-securitySolutionCypress', './test/scripts/jenkins_security_solution_cypress.sh')(processNumber)
4848
}
4949
},

docs/apm/error-reports-watcher.asciidoc

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/apm/how-to-guides.asciidoc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Learn how to perform common APM app tasks.
88
* <<agent-configuration>>
99
* <<apm-alerts>>
1010
* <<custom-links>>
11-
* <<errors-alerts-with-watcher>>
1211
* <<filters>>
1312
* <<machine-learning-integration>>
1413
* <<advanced-queries>>
@@ -21,8 +20,6 @@ include::apm-alerts.asciidoc[]
2120

2221
include::custom-links.asciidoc[]
2322

24-
include::error-reports-watcher.asciidoc[]
25-
2623
include::filters.asciidoc[]
2724

2825
include::machine-learning.asciidoc[]

docs/developer/advanced/running-elasticsearch.asciidoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ This will run a snapshot of {es} that is usually built nightly. Read more about
1313
----
1414
yarn es snapshot
1515
----
16+
By default, two users are added to Elasticsearch:
17+
18+
- A superuser with username: `elastic` and password: `changeme`, which can be used to log into Kibana with.
19+
- A user with username: `kibana_system` and password `changeme`. This account is used by the Kibana server to authenticate itself to Elasticsearch, and to perform certain actions on behalf of the end user. These credentials should be specified in your kibana.yml as described in <<using-kibana-with-security>>
1620

1721
See all available options, like how to specify a specific license, with the `--help` flag.
1822

@@ -115,4 +119,4 @@ PUT _cluster/settings
115119
}
116120
----
117121

118-
Follow the cross-cluster search instructions for setting up index patterns to search across clusters (<<management-cross-cluster-search>>).
122+
Follow the cross-cluster search instructions for setting up index patterns to search across clusters (<<management-cross-cluster-search>>).

docs/developer/architecture/code-exploration.asciidoc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ WARNING: Missing README.
186186
Replaces the legacy ui/share module for registering share context menus.
187187
188188
189-
- {kib-repo}blob/{branch}/src/plugins/status_page[statusPage]
190-
191-
WARNING: Missing README.
192-
193-
194189
- {kib-repo}blob/{branch}/src/plugins/telemetry/README.md[telemetry]
195190
196191
Telemetry allows Kibana features to have usage tracked in the wild. The general term "telemetry" refers to multiple things:
@@ -529,9 +524,9 @@ WARNING: Missing README.
529524
See Configuring security in Kibana.
530525
531526
532-
- {kib-repo}blob/{branch}/x-pack/plugins/security_solution[securitySolution]
527+
- {kib-repo}blob/{branch}/x-pack/plugins/security_solution/README.md[securitySolution]
533528
534-
WARNING: Missing README.
529+
Welcome to the Kibana Security Solution plugin! This README will go over getting started with development and testing.
535530
536531
537532
- {kib-repo}blob/{branch}/x-pack/plugins/snapshot_restore/README.md[snapshotRestore]

docs/developer/contributing/development-tests.asciidoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ root)
2626
|Functional
2727
|`test/*integration/**/config.js` `test/*functional/**/config.js` `test/accessibility/config.js`
2828
|`yarn test:ftr:server --config test/[directory]/config.js``yarn test:ftr:runner --config test/[directory]/config.js --grep=regexp`
29-
30-
|Karma |`src/**/public/__tests__/*.js` |`yarn test:karma:debug`
3129
|===
3230

3331
For X-Pack tests located in `x-pack/` see

docs/developer/contributing/development-unit-tests.asciidoc

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -95,38 +95,6 @@ to proceed in this mode.
9595
node scripts/mocha --debug <file>
9696
----
9797

98-
With `yarn test:karma`, you can run only the browser tests. Coverage
99-
reports are available for browser tests by running
100-
`yarn test:coverage`. You can find the results under the `coverage/`
101-
directory that will be created upon completion.
102-
103-
[source,bash]
104-
----
105-
yarn test:karma
106-
----
107-
108-
Using `yarn test:karma:debug` initializes an environment for debugging
109-
the browser tests. Includes an dedicated instance of the {kib} server
110-
for building the test bundle, and a karma server. When running this task
111-
the build is optimized for the first time and then a karma-owned
112-
instance of the browser is opened. Click the "`debug`" button to open a
113-
new tab that executes the unit tests.
114-
115-
[source,bash]
116-
----
117-
yarn test:karma:debug
118-
----
119-
120-
In the screenshot below, you’ll notice the URL is
121-
`localhost:9876/debug.html`. You can append a `grep` query parameter
122-
to this URL and set it to a string value which will be used to exclude
123-
tests which don’t match. For example, if you changed the URL to
124-
`localhost:9876/debug.html?query=my test` and then refreshed the
125-
browser, you’d only see tests run which contain "`my test`" in the test
126-
description.
127-
128-
image:http://i.imgur.com/DwHxgfq.png[Browser test debugging]
129-
13098
[discrete]
13199
=== Unit Testing Plugins
132100

@@ -141,5 +109,4 @@ command from your plugin:
141109
[source,bash]
142110
----
143111
yarn test:mocha
144-
yarn test:karma:debug # remove the debug flag to run them once and close
145112
----

0 commit comments

Comments
 (0)