d6c0557e86
* Add support for HTTP proxy listeners * Add customizable bootstrap configuration options * Debug logging for xDS AuthZ * Add Envoy Integration test suite with basic test coverage * Add envoy command tests to cover new cases * Add tracing integration test * Add gRPC support WIP * Merged changes from master Docker. get CI integration to work with same Dockerfile now * Make docker build optional for integration * Enable integration tests again! * http2 and grpc integration tests and fixes * Fix up command config tests * Store all container logs as artifacts in circle on fail * Add retries to outer part of stats measurements as we keep missing them in CI * Only dump logs on failing cases * Fix typos from code review * Review tidying and make tests pass again * Add debug logs to exec test. * Fix legit test failure caused by upstream rename in envoy config * Attempt to reduce cases of bad TLS handshake in CI integration tests * bring up the right service * Add prometheus integration test * Add test for denied AuthZ both HTTP and TCP * Try ANSI term for Circle
44 lines
995 B
Go
44 lines
995 B
Go
package xds
|
|
|
|
import (
|
|
"flag"
|
|
"io/ioutil"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
envoy "github.com/envoyproxy/go-control-plane/envoy/api/v2"
|
|
"github.com/gogo/protobuf/jsonpb"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// update allows golden files to be updated based on the current output.
|
|
var update = flag.Bool("update", false, "update golden files")
|
|
|
|
// golden reads and optionally writes the expected data to the golden file,
|
|
// returning the contents as a string.
|
|
func golden(t *testing.T, name, got string) string {
|
|
t.Helper()
|
|
|
|
golden := filepath.Join("testdata", name+".golden")
|
|
if *update && got != "" {
|
|
err := ioutil.WriteFile(golden, []byte(got), 0644)
|
|
require.NoError(t, err)
|
|
}
|
|
|
|
expected, err := ioutil.ReadFile(golden)
|
|
require.NoError(t, err)
|
|
|
|
return string(expected)
|
|
}
|
|
|
|
func responseToJSON(t *testing.T, r *envoy.DiscoveryResponse) string {
|
|
t.Helper()
|
|
m := jsonpb.Marshaler{
|
|
Indent: " ",
|
|
}
|
|
gotJSON, err := m.MarshalToString(r)
|
|
require.NoError(t, err)
|
|
return gotJSON
|
|
}
|