-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Add secrets package API integration test (#164583)
## Summary Closes #162045 This PR adds an API integration test for the following scenario: - Given an integration with some non secret (plain text) vars that become secret in a newer version; - When Fleet has an agent policy with this integration and upgrades from the old to the newer version; - Then the vars that have become secrets should correctly be stored as secret values. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Julia Bardi <[email protected]> (cherry picked from commit 766ff8f)
- Loading branch information
1 parent
1e077b1
commit 23d25bb
Showing
12 changed files
with
237 additions
and
12 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...ation/apis/fixtures/test_packages/secrets/1.0.0/data_stream/log/agent/input/input.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
package_var_secret: {{package_var_secret}} | ||
package_var_non_secret: {{package_var_non_secret}} | ||
input_var_secret: {{input_var_secret}} | ||
input_var_non_secret: {{input_var_non_secret}} |
3 changes: 3 additions & 0 deletions
3
...ion/apis/fixtures/test_packages/secrets/1.0.0/data_stream/log/agent/stream/stream.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
config.version: "2" | ||
package_var_secret: {{package_var_secret}} | ||
package_var_non_secret: {{package_var_non_secret}} | ||
input_var_secret: {{input_var_secret}} | ||
input_var_non_secret: {{input_var_non_secret}} | ||
stream_var_secret: {{stream_var_secret}} | ||
stream_var_non_secret: {{stream_var_non_secret}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...ation/apis/fixtures/test_packages/secrets/1.1.0/data_stream/log/agent/input/input.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package_var_secret: {{package_var_secret}} | ||
package_var_non_secret: {{package_var_non_secret}} | ||
input_var_secret: {{input_var_secret}} | ||
input_var_non_secret: {{input_var_non_secret}} |
7 changes: 7 additions & 0 deletions
7
...ion/apis/fixtures/test_packages/secrets/1.1.0/data_stream/log/agent/stream/stream.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
config.version: "2" | ||
package_var_secret: {{package_var_secret}} | ||
package_var_non_secret: {{package_var_non_secret}} | ||
input_var_secret: {{input_var_secret}} | ||
input_var_non_secret: {{input_var_non_secret}} | ||
stream_var_secret: {{stream_var_secret}} | ||
stream_var_non_secret: {{stream_var_non_secret}} |
16 changes: 16 additions & 0 deletions
16
...i_integration/apis/fixtures/test_packages/secrets/1.1.0/data_stream/log/fields/fields.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- name: data_stream.type | ||
type: constant_keyword | ||
description: > | ||
Data stream type. | ||
- name: data_stream.dataset | ||
type: constant_keyword | ||
description: > | ||
Data stream dataset. | ||
- name: data_stream.namespace | ||
type: constant_keyword | ||
description: > | ||
Data stream namespace. | ||
- name: '@timestamp' | ||
type: date | ||
description: > | ||
Event timestamp. |
18 changes: 18 additions & 0 deletions
18
...et_api_integration/apis/fixtures/test_packages/secrets/1.1.0/data_stream/log/manifest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
title: Test stream | ||
type: logs | ||
streams: | ||
- input: test_input | ||
title: test input | ||
vars: | ||
- name: stream_var_secret | ||
type: text | ||
title: Stream Var Secret | ||
multi: false | ||
show_user: true | ||
secret: true | ||
- name: stream_var_non_secret | ||
type: text | ||
title: Stream Var Non Secret | ||
multi: false | ||
show_user: true | ||
secret: true |
3 changes: 3 additions & 0 deletions
3
.../fleet_api_integration/apis/fixtures/test_packages/secrets/1.1.0/docs/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# secrets | ||
|
||
This package has secrets |
7 changes: 7 additions & 0 deletions
7
...st/fleet_api_integration/apis/fixtures/test_packages/secrets/1.1.0/img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions
64
x-pack/test/fleet_api_integration/apis/fixtures/test_packages/secrets/1.1.0/manifest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
format_version: 1.0.0 | ||
name: secrets | ||
title: Package with secrets | ||
description: This integration package has 3 secret and 3 non secret vars. | ||
version: 1.1.0 | ||
categories: [] | ||
# Options are experimental, beta, ga | ||
release: beta | ||
# The package type. The options for now are [integration, solution], more type might be added in the future. | ||
# The default type is integration and will be set if empty. | ||
type: integration | ||
license: basic | ||
owner: | ||
github: elastic/fleet | ||
|
||
requirement: | ||
elasticsearch: | ||
versions: ">7.7.0" | ||
kibana: | ||
versions: ">7.7.0" | ||
|
||
icons: | ||
- src: "/img/logo.svg" | ||
size: "16x16" | ||
type: "image/svg+xml" | ||
|
||
vars: | ||
- name: package_var_secret | ||
type: password | ||
title: Package Var Secret | ||
multi: false | ||
required: true | ||
show_user: true | ||
secret: true | ||
- name: package_var_non_secret | ||
type: text | ||
title: Package Var Non Secret | ||
multi: false | ||
required: true | ||
show_user: true | ||
secret: true | ||
policy_templates: | ||
- name: secrets | ||
title: This | ||
description: Test Package for Upgrading Package Policies | ||
inputs: | ||
- type: test_input | ||
title: Test Input | ||
description: Test Input | ||
enabled: true | ||
template_path: input.yml.hbs | ||
vars: | ||
- name: input_var_secret | ||
type: text | ||
title: Input Var Secret | ||
multi: false | ||
show_user: true | ||
secret: true | ||
- name: input_var_non_secret | ||
type: text | ||
title: Input Var Non Secret | ||
multi: false | ||
show_user: true | ||
secret: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters