istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/test/framework/components/echo/sidecar.go (about)

     1  // Copyright Istio Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package echo
    16  
    17  import (
    18  	admin "github.com/envoyproxy/go-control-plane/envoy/admin/v3"
    19  
    20  	"istio.io/istio/pkg/test"
    21  	"istio.io/istio/pkg/test/util/retry"
    22  )
    23  
    24  // Sidecar provides an interface to execute queries against a single Envoy sidecar.
    25  type Sidecar interface {
    26  	// Info about the Envoy instance.
    27  	Info() (*admin.ServerInfo, error)
    28  	InfoOrFail(t test.Failer) *admin.ServerInfo
    29  
    30  	// Config of the Envoy instance.
    31  	Config() (*admin.ConfigDump, error)
    32  	ConfigOrFail(t test.Failer) *admin.ConfigDump
    33  
    34  	// WaitForConfig queries the Envoy configuration an executes the given accept handler. If the
    35  	// response is not accepted, the request will be retried until either a timeout or a response
    36  	// has been accepted.
    37  	WaitForConfig(accept func(*admin.ConfigDump) (bool, error), options ...retry.Option) error
    38  	WaitForConfigOrFail(t test.Failer, accept func(*admin.ConfigDump) (bool, error), options ...retry.Option)
    39  
    40  	// Clusters for the Envoy instance
    41  	Clusters() (*admin.Clusters, error)
    42  	ClustersOrFail(t test.Failer) *admin.Clusters
    43  
    44  	// Listeners for the Envoy instance
    45  	Listeners() (*admin.Listeners, error)
    46  	ListenersOrFail(t test.Failer) *admin.Listeners
    47  
    48  	// Logs returns the logs for the sidecar container
    49  	Logs() (string, error)
    50  	// LogsOrFail returns the logs for the sidecar container, or aborts if an error is found
    51  	LogsOrFail(t test.Failer) string
    52  }