a8faa543e6
* Rename integation_test.go->integration_test.go Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Add ability to fetch container's network addresses This lets us return the on-network container address, allowing us to spawn client containers which contact server containers. Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Add integration tests with nginx, curl, wget, Go We build new integration tests, spawning a test instance on nginx and ensuring we can connect with a variety of clients against a variety of CA and leaf certificate types. This will ultimately let us detect issues with compatibility as we expand the matrix of supported servers and clients. Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Make runner reference unique Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Attempt to fix CI with longer wait Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Finish moving nginx tests to pkiext package Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * make fmt Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Add more debugging, work on CircleCI Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package pkiext
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/vault/sdk/logical"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func requireFieldsSetInResp(t *testing.T, resp *logical.Response, fields ...string) {
|
|
var missingFields []string
|
|
for _, field := range fields {
|
|
value, ok := resp.Data[field]
|
|
if !ok || value == nil {
|
|
missingFields = append(missingFields, field)
|
|
}
|
|
}
|
|
|
|
require.Empty(t, missingFields, "The following fields were required but missing from response:\n%v", resp.Data)
|
|
}
|
|
|
|
func requireSuccessNonNilResponse(t *testing.T, resp *logical.Response, err error, msgAndArgs ...interface{}) {
|
|
require.NoError(t, err, msgAndArgs...)
|
|
if resp.IsError() {
|
|
errContext := fmt.Sprintf("Expected successful response but got error: %v", resp.Error())
|
|
require.Falsef(t, resp.IsError(), errContext, msgAndArgs...)
|
|
}
|
|
require.NotNil(t, resp, msgAndArgs...)
|
|
}
|
|
|
|
func requireSuccessNilResponse(t *testing.T, resp *logical.Response, err error, msgAndArgs ...interface{}) {
|
|
require.NoError(t, err, msgAndArgs...)
|
|
if resp.IsError() {
|
|
errContext := fmt.Sprintf("Expected successful response but got error: %v", resp.Error())
|
|
require.Falsef(t, resp.IsError(), errContext, msgAndArgs...)
|
|
}
|
|
if resp != nil {
|
|
msg := fmt.Sprintf("expected nil response but got: %v", resp)
|
|
require.Nilf(t, resp, msg, msgAndArgs...)
|
|
}
|
|
}
|