diff --git a/x-pack/elastic-agent/pkg/fleetapi/client.go b/x-pack/elastic-agent/pkg/fleetapi/client.go index 648620dcab98..bfdc131ce908 100644 --- a/x-pack/elastic-agent/pkg/fleetapi/client.go +++ b/x-pack/elastic-agent/pkg/fleetapi/client.go @@ -34,7 +34,6 @@ type clienter interface { var baseRoundTrippers = func(rt http.RoundTripper) (http.RoundTripper, error) { rt = NewFleetUserAgentRoundTripper(rt, release.Version()) - rt = kibana.NewEnforceKibanaVersionRoundTripper(rt, release.Version()) return rt, nil } diff --git a/x-pack/elastic-agent/pkg/fleetapi/client_test.go b/x-pack/elastic-agent/pkg/fleetapi/client_test.go index 305bbafc1174..5766fe109a6f 100644 --- a/x-pack/elastic-agent/pkg/fleetapi/client_test.go +++ b/x-pack/elastic-agent/pkg/fleetapi/client_test.go @@ -17,43 +17,12 @@ import ( "github.com/stretchr/testify/require" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/config" - "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/kibana" - "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/release" ) func TestHTTPClient(t *testing.T) { ctx := context.Background() - t.Run("Ensure we validate the remote Kibana version is higher or equal", withServer( - func(t *testing.T) *http.ServeMux { - msg := `{ message: "hello" }` - mux := http.NewServeMux() - mux.HandleFunc("/echo-hello", authHandler(func(w http.ResponseWriter, r *http.Request) { - v := r.Header.Get("kbn-version") - assert.Equal(t, release.Version(), v) - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, msg) - }, "abc123")) - return mux - }, func(t *testing.T, host string) { - cfg := &kibana.Config{ - Host: host, - } - - l, err := logger.New() - client, err := NewAuthWithConfig(l, "abc123", cfg) - require.NoError(t, err) - resp, err := client.Send(ctx, "GET", "/echo-hello", nil, nil, nil) - require.NoError(t, err) - - body, err := ioutil.ReadAll(resp.Body) - require.NoError(t, err) - defer resp.Body.Close() - assert.Equal(t, `{ message: "hello" }`, string(body)) - }, - )) - t.Run("API Key is valid", withServer( func(t *testing.T) *http.ServeMux { msg := `{ message: "hello" }` diff --git a/x-pack/elastic-agent/pkg/kibana/round_trippers.go b/x-pack/elastic-agent/pkg/kibana/round_trippers.go index 4adbee0e476e..ded029356716 100644 --- a/x-pack/elastic-agent/pkg/kibana/round_trippers.go +++ b/x-pack/elastic-agent/pkg/kibana/round_trippers.go @@ -138,7 +138,7 @@ func (r *EnforceKibanaVersionRoundTripper) RoundTrip(req *http.Request) (*http.R } // NewEnforceKibanaVersionRoundTripper enforce the remove endpoint to be a a certain version, if the -// remove kibana is not equal or superior on the requested version the call will fail. +// remote kibana is not equal the call will fail. func NewEnforceKibanaVersionRoundTripper(wrapped http.RoundTripper, version string) http.RoundTripper { return &EnforceKibanaVersionRoundTripper{rt: wrapped, version: version} }