github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/pkg/test/main/README.md (about)

     1  # End-to-end testing script
     2  
     3  This directory contains a basic end-to-end testing script.
     4  The script sets up a configuration cache, stands up a configuration server,
     5  and starts up Envoy with the server as either ADS or xDS discovery option. The
     6  configuration is periodically refreshed with new routes and new clusters. In
     7  parallel, the test sends echo requests one after another through Envoy,
     8  exercising the pushed configuration.
     9  
    10  ## Requirements
    11  
    12  * Envoy binary `envoy` available: set `ENVOY` environment variable to the
    13    location of the binary, or use the default value `/usr/local/bin/envoy`
    14  * `go-control-plane` builds successfully
    15  
    16  ## Steps
    17  
    18  To run the script with a single ADS server:
    19  
    20      make integration.ads
    21  
    22  To run the script with a single server configured as different xDS servers:
    23  
    24      make integration.xds
    25  
    26  To run the script with a single server configured to use `Fetch` through HTTP:
    27  
    28      make integration.rest
    29  
    30  You should see runs of configuration push events and request batch reports. The
    31  test executes batches of requests to exercise multiple listeners, routes, and
    32  clusters, and records the number of successful and failed requests. The test is
    33  successful if at least one batch passes through all requests (e.g. Envoy
    34  eventually converges to use the latest pushed configuration) for each run.
    35  
    36  ## Customizing the test driver
    37  
    38  You can run ```bin/test -help``` to get a list of the cli flags that
    39  the test program accepts.  There are also comments in ```main.go```.
    40  
    41  ## Using the pprof profiler
    42  
    43  One customization is to run the go language profiler [pprof](https://github.com/DataDog/go-profiler-notes/blob/main/pprof.md). See also <https://golang.org/pkg/runtime/pprof/>.
    44  
    45  The profiler is normally off because it adds overhead to the tests. You can turn 
    46  it on with the command line option `--pprof`. There is an environment variable 
    47  `PPROF` for the `make` commands shown above. For example:
    48  
    49      (export PPROF=true; make integration.xds)
    50  
    51  The test will then write files of the form `block_profile_xds.pb.gz`. The files
    52  get written to the root of the project, in the same place as the envoy logs.
    53  
    54  You can use `go tool pprof bin/test <file name>` to analyze the profile data.