Skip to content

Fakewebapi simulare a Fleet API endpoint for testing the checkin#14945

Merged
ph merged 2 commits intoelastic:fleetfrom
ph:agent/fakewebapi
Dec 5, 2019
Merged

Fakewebapi simulare a Fleet API endpoint for testing the checkin#14945
ph merged 2 commits intoelastic:fleetfrom
ph:agent/fakewebapi

Conversation

@ph
Copy link
Copy Markdown
Contributor

@ph ph commented Dec 4, 2019

This PR creates a crude fake webserver to allow a beat agent to enroll
and receives action from a remote host.

@michalpristas This is really a quick and dirty webserver just to simulate a subset of the Fleet API, There are currently no validation for the action that are acked.

This PR creates a crude fake webserver to allow a beat agent to enroll
and receives action from a remote host.
Copy link
Copy Markdown
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 i think this can be used later in some kind of integration tests until we have them with real API

i think you will need to sort out licenses before mergin

@@ -0,0 +1,5 @@
#!/bin/sh
APIKEY=${1:-"abc123"}
AGENTID=${2:-"agent007"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shameless influence from a trailer.

}

func handlerCheckin(w http.ResponseWriter, r *http.Request) {
mutex.Lock()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what this lock locks?
you are responding with same response always, what about preparing mashalled response upfront

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I wanted to make it more freeform, you can actually push a new configuration using the handlerAction

@ph ph merged commit aef8334 into elastic:fleet Dec 5, 2019
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…stic#14945)

* Fakewebapi simulare a Fleet API endpoint for testing the checkin

This PR creates a crude fake webserver to allow a beat agent to enroll
and receives action from a remote host.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants