mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 03:58:01 +00:00
Fix api/ and sdk/ package tests (#25067)
* fix * left in incorrectly * don't print generate commands * handle line breaks * remove -e
This commit is contained in:
4
.github/workflows/test-go.yml
vendored
4
.github/workflows/test-go.yml
vendored
@@ -141,7 +141,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# testonly tests need additional build tag though let's exclude them anyway for clarity
|
# testonly tests need additional build tag though let's exclude them anyway for clarity
|
||||||
(
|
(
|
||||||
go list ./... | grep -v "_binary" | grep -v "vault/integ" | grep -v "testonly" | gotestsum tool ci-matrix --debug \
|
make all-packages | grep -v "_binary" | grep -v "vault/integ" | grep -v "testonly" | gotestsum tool ci-matrix --debug \
|
||||||
--partitions "${{ inputs.total-runners }}" \
|
--partitions "${{ inputs.total-runners }}" \
|
||||||
--timing-files 'test-results/go-test/*.json' > matrix.json
|
--timing-files 'test-results/go-test/*.json' > matrix.json
|
||||||
)
|
)
|
||||||
@@ -166,7 +166,7 @@ jobs:
|
|||||||
if: inputs.binary-tests
|
if: inputs.binary-tests
|
||||||
id: list-binary-tests
|
id: list-binary-tests
|
||||||
run: |
|
run: |
|
||||||
LIST="$(go list ./... | grep "_binary" | xargs)"
|
LIST="$(make all-packages | grep "_binary" | xargs)"
|
||||||
echo "list=$LIST" >> "$GITHUB_OUTPUT"
|
echo "list=$LIST" >> "$GITHUB_OUTPUT"
|
||||||
- name: Build complete matrix
|
- name: Build complete matrix
|
||||||
id: build
|
id: build
|
||||||
|
|||||||
14
Makefile
14
Makefile
@@ -2,7 +2,11 @@
|
|||||||
# Be sure to place this BEFORE `include` directives, if any.
|
# Be sure to place this BEFORE `include` directives, if any.
|
||||||
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
TEST?=$$($(GO_CMD) list ./... | grep -v /vendor/ | grep -v /integ)
|
MAIN_PACKAGES=$$($(GO_CMD) list ./... | grep -v vendor/ )
|
||||||
|
SDK_PACKAGES=$$(cd $(CURDIR)/sdk && $(GO_CMD) list ./... | grep -v vendor/ )
|
||||||
|
API_PACKAGES=$$(cd $(CURDIR)/api && $(GO_CMD) list ./... | grep -v vendor/ )
|
||||||
|
ALL_PACKAGES=$(MAIN_PACKAGES) $(SDK_PACKAGES) $(API_PACKAGES)
|
||||||
|
TEST=$$(echo $(ALL_PACKAGES) | grep -v integ/ )
|
||||||
TEST_TIMEOUT?=45m
|
TEST_TIMEOUT?=45m
|
||||||
EXTENDED_TEST_TIMEOUT=60m
|
EXTENDED_TEST_TIMEOUT=60m
|
||||||
INTEG_TEST_TIMEOUT=120m
|
INTEG_TEST_TIMEOUT=120m
|
||||||
@@ -156,7 +160,9 @@ protolint: prep check-tools-external
|
|||||||
# dependency.
|
# dependency.
|
||||||
prep: check-go-version
|
prep: check-go-version
|
||||||
@echo "==> Running go generate..."
|
@echo "==> Running go generate..."
|
||||||
@GOARCH= GOOS= $(GO_CMD) generate $$($(GO_CMD) list ./... | grep -v /vendor/)
|
@GOARCH= GOOS= $(GO_CMD) generate $(MAIN_PACKAGES)
|
||||||
|
@GOARCH= GOOS= cd api && $(GO_CMD) generate $(API_PACKAGES)
|
||||||
|
@GOARCH= GOOS= cd sdk && $(GO_CMD) generate $(SDK_PACKAGES)
|
||||||
@if [ -d .git/hooks ]; then cp .hooks/* .git/hooks/; fi
|
@if [ -d .git/hooks ]; then cp .hooks/* .git/hooks/; fi
|
||||||
|
|
||||||
# bootstrap the build by generating any necessary code and downloading additional tools that may
|
# bootstrap the build by generating any necessary code and downloading additional tools that may
|
||||||
@@ -369,3 +375,7 @@ ci-copywriteheaders:
|
|||||||
.PHONY: all bin default prep test vet bootstrap fmt fmtcheck mysql-database-plugin mysql-legacy-database-plugin cassandra-database-plugin influxdb-database-plugin postgresql-database-plugin mssql-database-plugin hana-database-plugin mongodb-database-plugin ember-dist ember-dist-dev static-dist static-dist-dev assetcheck check-vault-in-path packages build build-ci semgrep semgrep-ci vet-codechecker ci-vet-codechecker clean dev
|
.PHONY: all bin default prep test vet bootstrap fmt fmtcheck mysql-database-plugin mysql-legacy-database-plugin cassandra-database-plugin influxdb-database-plugin postgresql-database-plugin mssql-database-plugin hana-database-plugin mongodb-database-plugin ember-dist ember-dist-dev static-dist static-dist-dev assetcheck check-vault-in-path packages build build-ci semgrep semgrep-ci vet-codechecker ci-vet-codechecker clean dev
|
||||||
|
|
||||||
.NOTPARALLEL: ember-dist ember-dist-dev
|
.NOTPARALLEL: ember-dist ember-dist-dev
|
||||||
|
|
||||||
|
.PHONY: all-packages
|
||||||
|
all-packages:
|
||||||
|
@echo $(ALL_PACKAGES) | tr ' ' '\n'
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func TestClientDefaultHttpClient_unixSocket(t *testing.T) {
|
|||||||
if client.addr.Scheme != "http" {
|
if client.addr.Scheme != "http" {
|
||||||
t.Fatalf("bad: %s", client.addr.Scheme)
|
t.Fatalf("bad: %s", client.addr.Scheme)
|
||||||
}
|
}
|
||||||
if client.addr.Host != "/var/run/vault.sock" {
|
if client.addr.Host != "localhost" {
|
||||||
t.Fatalf("bad: %s", client.addr.Host)
|
t.Fatalf("bad: %s", client.addr.Host)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,8 +111,8 @@ func TestClientSetAddress(t *testing.T) {
|
|||||||
if client.addr.Scheme != "http" {
|
if client.addr.Scheme != "http" {
|
||||||
t.Fatalf("bad: expected: 'http' actual: %q", client.addr.Scheme)
|
t.Fatalf("bad: expected: 'http' actual: %q", client.addr.Scheme)
|
||||||
}
|
}
|
||||||
if client.addr.Host != "/var/run/vault.sock" {
|
if client.addr.Host != "localhost" {
|
||||||
t.Fatalf("bad: expected: '/var/run/vault.sock' actual: %q", client.addr.Host)
|
t.Fatalf("bad: expected: 'localhost' actual: %q", client.addr.Host)
|
||||||
}
|
}
|
||||||
if client.addr.Path != "" {
|
if client.addr.Path != "" {
|
||||||
t.Fatalf("bad: expected '' actual: %q", client.addr.Path)
|
t.Fatalf("bad: expected '' actual: %q", client.addr.Path)
|
||||||
@@ -1521,7 +1521,7 @@ func TestParseAddressWithUnixSocket(t *testing.T) {
|
|||||||
if u.Scheme != "http" {
|
if u.Scheme != "http" {
|
||||||
t.Fatal("Scheme not changed to http")
|
t.Fatal("Scheme not changed to http")
|
||||||
}
|
}
|
||||||
if u.Host != "/var/run/vault.sock" {
|
if u.Host != "localhost" {
|
||||||
t.Fatal("Host not changed to socket name")
|
t.Fatal("Host not changed to socket name")
|
||||||
}
|
}
|
||||||
if u.Path != "" {
|
if u.Path != "" {
|
||||||
|
|||||||
@@ -1174,24 +1174,26 @@ func hyphenatedToTitleCase(in string) string {
|
|||||||
// cleanedResponse is identical to logical.Response but with nulls
|
// cleanedResponse is identical to logical.Response but with nulls
|
||||||
// removed from from JSON encoding
|
// removed from from JSON encoding
|
||||||
type cleanedResponse struct {
|
type cleanedResponse struct {
|
||||||
Secret *logical.Secret `json:"secret,omitempty"`
|
Secret *logical.Secret `json:"secret,omitempty"`
|
||||||
Auth *logical.Auth `json:"auth,omitempty"`
|
Auth *logical.Auth `json:"auth,omitempty"`
|
||||||
Data map[string]interface{} `json:"data,omitempty"`
|
Data map[string]interface{} `json:"data,omitempty"`
|
||||||
Redirect string `json:"redirect,omitempty"`
|
Redirect string `json:"redirect,omitempty"`
|
||||||
Warnings []string `json:"warnings,omitempty"`
|
Warnings []string `json:"warnings,omitempty"`
|
||||||
WrapInfo *wrapping.ResponseWrapInfo `json:"wrap_info,omitempty"`
|
WrapInfo *wrapping.ResponseWrapInfo `json:"wrap_info,omitempty"`
|
||||||
Headers map[string][]string `json:"headers,omitempty"`
|
Headers map[string][]string `json:"headers,omitempty"`
|
||||||
|
MountType string `json:"mount_type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanResponse(resp *logical.Response) *cleanedResponse {
|
func cleanResponse(resp *logical.Response) *cleanedResponse {
|
||||||
return &cleanedResponse{
|
return &cleanedResponse{
|
||||||
Secret: resp.Secret,
|
Secret: resp.Secret,
|
||||||
Auth: resp.Auth,
|
Auth: resp.Auth,
|
||||||
Data: resp.Data,
|
Data: resp.Data,
|
||||||
Redirect: resp.Redirect,
|
Redirect: resp.Redirect,
|
||||||
Warnings: resp.Warnings,
|
Warnings: resp.Warnings,
|
||||||
WrapInfo: resp.WrapInfo,
|
WrapInfo: resp.WrapInfo,
|
||||||
Headers: resp.Headers,
|
Headers: resp.Headers,
|
||||||
|
MountType: resp.MountType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -655,13 +655,14 @@ func TestOpenAPI_CleanResponse(t *testing.T) {
|
|||||||
// logical.Response. This will fail if logical.Response changes without a corresponding
|
// logical.Response. This will fail if logical.Response changes without a corresponding
|
||||||
// change to cleanResponse()
|
// change to cleanResponse()
|
||||||
orig = &logical.Response{
|
orig = &logical.Response{
|
||||||
Secret: new(logical.Secret),
|
Secret: new(logical.Secret),
|
||||||
Auth: new(logical.Auth),
|
Auth: new(logical.Auth),
|
||||||
Data: map[string]interface{}{"foo": 42},
|
Data: map[string]interface{}{"foo": 42},
|
||||||
Redirect: "foo",
|
Redirect: "foo",
|
||||||
Warnings: []string{"foo"},
|
Warnings: []string{"foo"},
|
||||||
WrapInfo: &wrapping.ResponseWrapInfo{Token: "foo"},
|
WrapInfo: &wrapping.ResponseWrapInfo{Token: "foo"},
|
||||||
Headers: map[string][]string{"foo": {"bar"}},
|
Headers: map[string][]string{"foo": {"bar"}},
|
||||||
|
MountType: "mount",
|
||||||
}
|
}
|
||||||
origJSON := mustJSONMarshal(t, orig)
|
origJSON := mustJSONMarshal(t, orig)
|
||||||
|
|
||||||
@@ -900,7 +901,6 @@ func testPath(t *testing.T, path *Path, sp *logical.Paths, expectedJSON string)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare json by first decoding, then comparing with a deep equality check.
|
// Compare json by first decoding, then comparing with a deep equality check.
|
||||||
var expected, actual interface{}
|
var expected, actual interface{}
|
||||||
if err := jsonutil.DecodeJSON(docJSON, &actual); err != nil {
|
if err := jsonutil.DecodeJSON(docJSON, &actual); err != nil {
|
||||||
|
|||||||
140
sdk/framework/testdata/operations.json
vendored
140
sdk/framework/testdata/operations.json
vendored
@@ -12,20 +12,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"/foo/{id}": {
|
"/foo/{id}": {
|
||||||
"description": "Synopsis",
|
"description": "Synopsis",
|
||||||
"x-vault-createSupported": true,
|
|
||||||
"x-vault-sudo": true,
|
|
||||||
"x-vault-displayAttrs": {
|
|
||||||
"navigation": true
|
|
||||||
},
|
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
|
||||||
"name": "format",
|
|
||||||
"description": "a query param",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"description": "id path parameter",
|
"description": "id path parameter",
|
||||||
@@ -36,13 +23,28 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"x-vault-sudo": true,
|
||||||
|
"x-vault-createSupported": true,
|
||||||
|
"x-vault-displayAttrs": {
|
||||||
|
"navigation": true
|
||||||
|
},
|
||||||
"get": {
|
"get": {
|
||||||
|
"summary": "My Summary",
|
||||||
|
"description": "My Description",
|
||||||
"operationId": "kv-read-foo-id",
|
"operationId": "kv-read-foo-id",
|
||||||
"tags": [
|
"tags": [
|
||||||
"secrets"
|
"secrets"
|
||||||
],
|
],
|
||||||
"summary": "My Summary",
|
"parameters": [
|
||||||
"description": "My Description",
|
{
|
||||||
|
"name": "format",
|
||||||
|
"description": "a query param",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK"
|
"description": "OK"
|
||||||
@@ -50,12 +52,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"post": {
|
"post": {
|
||||||
|
"summary": "Update Summary",
|
||||||
|
"description": "Update Description",
|
||||||
"operationId": "kv-write-foo-id",
|
"operationId": "kv-write-foo-id",
|
||||||
"tags": [
|
"tags": [
|
||||||
"secrets"
|
"secrets"
|
||||||
],
|
],
|
||||||
"summary": "Update Summary",
|
|
||||||
"description": "Update Description",
|
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"required": true,
|
"required": true,
|
||||||
"content": {
|
"content": {
|
||||||
@@ -75,19 +77,7 @@
|
|||||||
},
|
},
|
||||||
"/foo/{id}/": {
|
"/foo/{id}/": {
|
||||||
"description": "Synopsis",
|
"description": "Synopsis",
|
||||||
"x-vault-sudo": true,
|
|
||||||
"x-vault-displayAttrs": {
|
|
||||||
"navigation": true
|
|
||||||
},
|
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
|
||||||
"name": "format",
|
|
||||||
"description": "a query param",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"description": "id path parameter",
|
"description": "id path parameter",
|
||||||
@@ -98,32 +88,51 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"x-vault-sudo": true,
|
||||||
|
"x-vault-displayAttrs": {
|
||||||
|
"navigation": true
|
||||||
|
},
|
||||||
"get": {
|
"get": {
|
||||||
|
"summary": "List Summary",
|
||||||
|
"description": "List Description",
|
||||||
"operationId": "kv-list-foo-id",
|
"operationId": "kv-list-foo-id",
|
||||||
"tags": [
|
"tags": [
|
||||||
"secrets"
|
"secrets"
|
||||||
],
|
],
|
||||||
"summary": "List Summary",
|
|
||||||
"description": "List Description",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "format",
|
||||||
|
"description": "a query param",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "list",
|
"name": "list",
|
||||||
"description": "Must be set to `true`",
|
"description": "Must be set to `true`",
|
||||||
"required": true,
|
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"true"
|
"true"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/StandardListResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -131,17 +140,7 @@
|
|||||||
"schemas": {
|
"schemas": {
|
||||||
"KvWriteFooIdRequest": {
|
"KvWriteFooIdRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
|
||||||
"age"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"flavors": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "the flavors",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"age": {
|
"age": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "the age",
|
"description": "the age",
|
||||||
@@ -152,16 +151,32 @@
|
|||||||
],
|
],
|
||||||
"x-vault-displayAttrs": {
|
"x-vault-displayAttrs": {
|
||||||
"name": "Age",
|
"name": "Age",
|
||||||
|
"value": 7,
|
||||||
"sensitive": true,
|
"sensitive": true,
|
||||||
"group": "Some Group",
|
"group": "Some Group"
|
||||||
"value": 7
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flavors": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "the flavors",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"format": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "a query param"
|
||||||
|
},
|
||||||
|
"maximum": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "a maximum value",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "the name",
|
"description": "the name",
|
||||||
"default": "Larry",
|
"pattern": "\\w([\\w-.]*\\w)?",
|
||||||
"pattern": "\\w([\\w-.]*\\w)?"
|
"default": "Larry"
|
||||||
},
|
},
|
||||||
"x-abc-token": {
|
"x-abc-token": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -171,14 +186,23 @@
|
|||||||
"b",
|
"b",
|
||||||
"c"
|
"c"
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
"maximum": {
|
},
|
||||||
"type": "integer",
|
"required": [
|
||||||
"description": "a maximum value",
|
"age"
|
||||||
"format": "int64"
|
]
|
||||||
|
},
|
||||||
|
"StandardListResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"keys": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
65
sdk/framework/testdata/operations_list.json
vendored
65
sdk/framework/testdata/operations_list.json
vendored
@@ -12,19 +12,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"/foo/{id}/": {
|
"/foo/{id}/": {
|
||||||
"description": "Synopsis",
|
"description": "Synopsis",
|
||||||
"x-vault-sudo": true,
|
|
||||||
"x-vault-displayAttrs": {
|
|
||||||
"navigation": true
|
|
||||||
},
|
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
|
||||||
"name": "format",
|
|
||||||
"description": "a query param",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"description": "id path parameter",
|
"description": "id path parameter",
|
||||||
@@ -35,36 +23,67 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"x-vault-sudo": true,
|
||||||
|
"x-vault-displayAttrs": {
|
||||||
|
"navigation": true
|
||||||
|
},
|
||||||
"get": {
|
"get": {
|
||||||
|
"summary": "List Summary",
|
||||||
|
"description": "List Description",
|
||||||
"operationId": "kv-list-foo-id",
|
"operationId": "kv-list-foo-id",
|
||||||
"tags": [
|
"tags": [
|
||||||
"secrets"
|
"secrets"
|
||||||
],
|
],
|
||||||
"summary": "List Summary",
|
|
||||||
"description": "List Description",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "format",
|
||||||
|
"description": "a query param",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "list",
|
"name": "list",
|
||||||
"description": "Must be set to `true`",
|
"description": "Must be set to `true`",
|
||||||
"required": true,
|
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"true"
|
"true"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/StandardListResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"components": {
|
"components": {
|
||||||
"schemas": {}
|
"schemas": {
|
||||||
|
"StandardListResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"keys": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ package clientcountutil
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
@@ -119,7 +120,10 @@ func TestWrite(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
body, err := io.ReadAll(r.Body)
|
body, err := io.ReadAll(r.Body)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.JSONEq(t, `{"write":["WRITE_ENTITIES"],"data":[{"monthsAgo":3,"all":{"clients":[{"count":1}]}},{"monthsAgo":2,"segments":{"segments":[{"segmentIndex":2,"clients":{"clients":[{"count":1,"repeated":true}]}}]}},{"currentMonth":true}]}`, string(body))
|
raw := map[string]string{}
|
||||||
|
err = json.Unmarshal(body, &raw)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.JSONEq(t, `{"write":["WRITE_ENTITIES"],"data":[{"monthsAgo":3,"all":{"clients":[{"count":1}]}},{"monthsAgo":2,"segments":{"segments":[{"segmentIndex":2,"clients":{"clients":[{"count":1,"repeated":true}]}}]}},{"currentMonth":true}]}`, raw["input"])
|
||||||
}))
|
}))
|
||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ func TestMakeConfig(t *testing.T) {
|
|||||||
responseWrapInfoTimes: 0,
|
responseWrapInfoTimes: 0,
|
||||||
|
|
||||||
mlockEnabled: false,
|
mlockEnabled: false,
|
||||||
mlockEnabledTimes: 1,
|
mlockEnabledTimes: 2,
|
||||||
|
|
||||||
expectedConfig: &plugin.ClientConfig{
|
expectedConfig: &plugin.ClientConfig{
|
||||||
HandshakeConfig: plugin.HandshakeConfig{
|
HandshakeConfig: plugin.HandshakeConfig{
|
||||||
@@ -341,9 +341,10 @@ func TestMakeConfig(t *testing.T) {
|
|||||||
plugin.ProtocolNetRPC,
|
plugin.ProtocolNetRPC,
|
||||||
plugin.ProtocolGRPC,
|
plugin.ProtocolGRPC,
|
||||||
},
|
},
|
||||||
Logger: hclog.NewNullLogger(),
|
Logger: hclog.NewNullLogger(),
|
||||||
AutoMTLS: true,
|
AutoMTLS: true,
|
||||||
SkipHostEnv: true,
|
SkipHostEnv: true,
|
||||||
|
GRPCBrokerMultiplex: true,
|
||||||
UnixSocketConfig: &plugin.UnixSocketConfig{
|
UnixSocketConfig: &plugin.UnixSocketConfig{
|
||||||
Group: strconv.Itoa(os.Getgid()),
|
Group: strconv.Itoa(os.Getgid()),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ func WaitForPerfReplicationWorking(ctx context.Context, pri, sec VaultCluster) e
|
|||||||
"bar": 1,
|
"bar": 1,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to write KV on primary", "path", path)
|
return fmt.Errorf("unable to write KV on primary, path=%s", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
for ctx.Err() == nil {
|
for ctx.Err() == nil {
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ func testGRPCBackend(t *testing.T) (logical.Backend, func()) {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
client, _ := gplugin.TestPluginGRPCConn(t, pluginMap)
|
client, _ := gplugin.TestPluginGRPCConn(t, false, pluginMap)
|
||||||
cleanup := func() {
|
cleanup := func() {
|
||||||
client.Close()
|
client.Close()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user