-
Notifications
You must be signed in to change notification settings - Fork 39
feat: initial specs for ingest management #126
Changes from 1 commit
85351cb
1123809
4c55304
b7355e2
cf41253
778e4d9
4395d0a
c56b8bf
c57fa4d
b588a63
3359246
8b27389
974b2e7
e74ee66
8ed05c6
6fef267
4096531
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| @ingest | ||
| Feature: Enable Fleet user and create initial Kibana setup | ||
|
mdelapenya marked this conversation as resolved.
Outdated
|
||
|
|
||
| Scenario: Enrolling an agent | ||
| Given there is a "Fleet" user in Kibana | ||
| And the "Fleet" Kibana setup has been created | ||
|
mdelapenya marked this conversation as resolved.
Outdated
|
||
| When the agent binary is installed in the target host | ||
| Then the dashboards for the agent are present in Elasticsearch | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to know the exact data needed here: the ES query
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the command to run the agent is: after this command is executed, we can wait a matter of seconds (5-20 seconds?) and then verify the existence of certain folders / data on the host as evidence of it working. and from here:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And for the Dashboards, lets actually use the API from Kibana, and even the Ingest one to assess this:
when called after the Agent is running, it will return a list of (currently in 7.8) 20 streams, with a format as: Lets assert the following...
I don't think we should walk the whole list here, I understand there is separate automation to confirm this and would make the test brittle to changes. How does that sound? |
||
| And the agent shows up in Kibana | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to get this without checking the UI, maybe an API call? I'd like to avoid any UI/DOM interaction if possible
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes is it. I was using very 'loose' language, 'shows up' and 'in Kibana' can be interpreted to the API as: I suggest we look only that the ID exists and that the current_error_events[] list is empty
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can call |
||
|
|
||
| Scenario: Un-enrolling an agent | ||
| Given there is a "Fleet" user in Kibana | ||
| And the "Fleet" Kibana setup has been created | ||
| And the agent binary is installed in the target host | ||
|
mdelapenya marked this conversation as resolved.
Outdated
|
||
| When the agent is un-enrolled from Kibana | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to mention that we'll have to manually terminate the shell / process running on the host as part of the 'tear down' of this scenario, in order to test the re-enrolling and re-starting of the Agent. |
||
| Then no new data shows up in Elasticsearc locations using the enrollment token | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I would phase it as 'using' the enrollment token, but its not entirely wrong. I'd phrase it as the host / agent is no longer able to send documents into ES (it will still be attempting to send them, running on the host)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here I think you should say using the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the clarification Nicholas! Please look at L27:33 There is specific scenario for revoking the enrollment token for an agent. Is that what you mean?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mmm, reading your comment, I'd rephrase this second scenario (the one revoking the token) to this: Scenario: Revoking the enrollment token for an agent
Given there is a "Fleet" user in Kibana
And the "Fleet" Kibana setup has been created
And the agent binary is installed in the target host
And the agent is un-enrolled from Kibana
When the enrollment token is revoked
Then no new data shows up in Elasticsearc locations using the enrollment token
And the enrolled agent continues to workAnd I'd create another use case: Scenario: A revoked enrollment token cannot enroll more agents
Given there is an enrollment token
When the enrollment token is revoked
Then it's not possible to use the token to enroll more agentsDoes it make sense to you?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, we should clarify what
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Combining above two scenarios into one: Scenario: Revoking the enrollment token for an agent
Given there is an agent enrolled with an enrollment token
When the enrollment token is revoked
Then it's not possible to use the token to enroll more agents
And the enrolled agent continues to work
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks so much Nicolas and Manu, I'm learning here too! Knowing now what I do, I'd suggest we really only have 1 distinct different case to test and I'd phrase it as: the pre-requisite for the test changes such that the agent is NOT running and is NOT already enrolled.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this scenario, because it's very straight-forward and simple at the same time. I'd replace what we had. wdyt about rephrasing the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, in what state would be the existing agent? Will it pause? will it continue to send data?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What data is not present here? I'd be great to understand more about its nature to identify when it shows up and when not
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated: translated into an ES query (forgive me if this is terrible, its a hacked version from dev tools and I didn't take the time to re-work it much:
GET _search
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This query is perfect! :) |
||
|
|
||
| Scenario: Enrolling, un-enrolling and re-enrolling an agent | ||
| Given there is a "Fleet" user in Kibana | ||
| And the "Fleet" Kibana setup has been created | ||
| And the agent binary is installed in the target host | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for this we can query: /api/ingest_manager/fleet/agents Request URL, POST: /api/ingest_manager/fleet/agents//unenroll
then we can query the list again and find it empty, with: response: at which point we can query the inverse state and find the agent in the inactive list with: and get a response with just one element in its list, like { "list": [ |
||
| And the agent is un-enrolled from Kibana | ||
| When the agent is re-enrolled from the host | ||
| And the agent runs from the host | ||
| Then the agent shows up in Kibana | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will need here the exact thing to check: and API call, an XPATH element in the UI...
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can absolutely get you the API calls and expectations. I don't know all of them off hand and am still digging thru 7.8 testing finding odd bugs, but I will work with the team tomorrow to fill in all of these with haste. we don't have the api documented yet either, so we'll get specifics for this and all similar requests in the branch
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the re-enroll call is exactly the same as it was prior, and the asserts are the same with the exception that we can check the timestamps on the metricbeat and filebeat files, to see that they are newer. newer than exactly what I'm not 100% sure on (there is some period where the Agent is in a state of transition. we could put a short pause in and wait for it to finish unenrolling and then capture that time and use it in the next step. ? |
||
|
|
||
| Scenario: Revoking the enrollment token for an agent | ||
| Given there is a "Fleet" user in Kibana | ||
| And the "Fleet" Kibana setup has been created | ||
| And the agent binary is installed in the target host | ||
| And the agent is un-enrolled from Kibana | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line 'And the agent is un-enrolled from Kibana' should be removed, the agent should be running as normal at this point. the purpose of this test is to validate a 2nd different way to cut off an agent from sending data into ES, which is to revoke the enrollment token. The agent un-enroll is very specific, however, the enrollment token revoking can impact a whole set of Agents (whichever were deployed with an enroll command that included the given token) its a way to bulk manage Agents, for some context. |
||
| When the enrollment token is revoked | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The revoke enrollment token API is this: The {id} to use in the above call can be retrieved from this call, there should only be key listed, so its the first 'id' in list position 0: { After it is revoked. you can run the same query And then we can wait 2 seconds and assert nothing new is ingested into ES just as above. |
||
| Then no new data shows up in Elasticsearc locations using the enrollment token | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is a final step we should ideally do here, we should attempt to re-enroll the Agent with the exact same string as before, but it should fail this time with an error message on the host cli as seen in this usage: edavis-mbp:elastic-agent-7.8.0-darwin-x86_64-BC5 edavis$ ./elastic-agent enroll https://fc0fe63733904e31ac7aec80b3dbf246.us-central1.gcp.foundit.no:443 R2JSX2dISUJtNzhySTBVS0JXMGM6aEJ6NlZyb0dUUWE3anhBNWRmLU9qQQ== fail to enroll: fail to execute request to Kibana: Status code: 401, Kibana returned an error: Unauthorized, message: [security_exception] missing authentication credentials for REST request [/_security/_authenticate], with { header={ WWW-Authenticate={ 0="Bearer realm="security"" & 1="ApiKey" & 2="Basic realm="security" charset="UTF-8"" } } } I suggest if we can, we parse this message for the keywords 'fail' 'unauthorized' (lowercased). |
||
| Scenario: Starting the agent starts backend processes | ||
| When the agent is started in the host | ||
| Then filebeat is started | ||
| And metricbeat is started | ||
|
mdelapenya marked this conversation as resolved.
Outdated
|
||
| And endpoint is started | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The BDD step is the same, so we could write just one implementation method, with an input parameter (the process to be present in the target) |
||
|
|
||
| Scenario: Stopping the agent stops backend processes | ||
| Given an agent is running in a host | ||
| When the agent is stopped in the host | ||
| Then filebeat is stopped | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we would need probably more like |
||
| And metricbeat is stopped | ||
| And endpoint is stopped | ||
|
mdelapenya marked this conversation as resolved.
Outdated
|
||
Uh oh!
There was an error while loading. Please reload this page.