Add support for interface field in http_response input plugin#6006
Add support for interface field in http_response input plugin#6006danielnelson merged 4 commits intoinfluxdata:masterfrom GeorgeMac:gm/inputs-http-response-interface
Conversation
|
|
||
| intf, err := findInterface() | ||
| if err != nil { | ||
| t.Fatal(err) |
There was a problem hiding this comment.
I likely would have just t.Skip(err), but then again I believe httptest.NewServer requires at least the loopback interface, so this is fine.
There was a problem hiding this comment.
I can change that if skip is preferred. I didn’t realize skip existed in that form.
There was a problem hiding this comment.
This seems fine, since we require the loopback in many tests, though in Telegraf we usually use testify: require.NoError(t, err).
|
|
||
| defer ts.Close() | ||
|
|
||
| intf, err := findInterface() |
There was a problem hiding this comment.
It seems like the test would depend on finding an interface that can route to the test http server network, which would only be a loopback interface because this server listens on 127.0.0.1:0. Could we simplify this function to just grab any loopback interface?
There was a problem hiding this comment.
Absolutely. That makes more sense. I was trying to test a non-loopback interface, which in hindsight makes no sense. I will make it get the name of the first loopback interface it finds.
|
|
||
| intf, err := findInterface() | ||
| if err != nil { | ||
| t.Fatal(err) |
There was a problem hiding this comment.
This seems fine, since we require the loopback in many tests, though in Telegraf we usually use testify: require.NoError(t, err).
This is an attempt to implement the
interfacefield in thehttp_responseinput plugin.The
interfacefield can be populated with an interface name such aseth0. A local address associated with the network interface will be derived and used for dialing.Resolves: #5856
Required for all PRs: