Skip to content

Commit

Permalink
backport of commit 49a59bd (#25072)
Browse files Browse the repository at this point in the history
Co-authored-by: miagilepner <[email protected]>
  • Loading branch information
1 parent 9951979 commit 400b3b3
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
run: |
# 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 }}" \
--timing-files 'test-results/go-test/*.json' > matrix.json
)
Expand All @@ -171,7 +171,7 @@ jobs:
if: inputs.binary-tests
id: list-binary-tests
run: |
LIST="$(go list ./... | grep "_binary" | xargs)"
LIST="$(make all-packages | grep "_binary" | xargs)"
echo "list=$LIST" >> "$GITHUB_OUTPUT"
- name: Build complete matrix
id: build
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
# Be sure to place this BEFORE `include` directives, if any.
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
EXTENDED_TEST_TIMEOUT=60m
INTEG_TEST_TIMEOUT=120m
Expand Down Expand Up @@ -156,7 +160,9 @@ protolint: prep check-tools-external
# dependency.
prep: check-go-version
@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

# bootstrap the build by generating any necessary code and downloading additional tools that may
Expand Down Expand Up @@ -371,3 +377,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

.NOTPARALLEL: ember-dist ember-dist-dev

.PHONY: all-packages
all-packages:
@echo $(ALL_PACKAGES) | tr ' ' '\n'
8 changes: 4 additions & 4 deletions api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestClientDefaultHttpClient_unixSocket(t *testing.T) {
if client.addr.Scheme != "http" {
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)
}
}
Expand All @@ -110,8 +110,8 @@ func TestClientSetAddress(t *testing.T) {
if client.addr.Scheme != "http" {
t.Fatalf("bad: expected: 'http' actual: %q", client.addr.Scheme)
}
if client.addr.Host != "/var/run/vault.sock" {
t.Fatalf("bad: expected: '/var/run/vault.sock' actual: %q", client.addr.Host)
if client.addr.Host != "localhost" {
t.Fatalf("bad: expected: 'localhost' actual: %q", client.addr.Host)
}
if client.addr.Path != "" {
t.Fatalf("bad: expected '' actual: %q", client.addr.Path)
Expand Down Expand Up @@ -1516,7 +1516,7 @@ func TestParseAddressWithUnixSocket(t *testing.T) {
if u.Scheme != "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")
}
if u.Path != "" {
Expand Down
4 changes: 4 additions & 0 deletions sdk/database/dbplugin/v5/plugin_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,7 @@ func (m *mockRunnerUtil) MlockEnabled() bool {
args := m.Called()
return args.Bool(0)
}

func (m *mockRunnerUtil) ClusterID(ctx context.Context) (string, error) {
return "clusterid", nil
}
1 change: 0 additions & 1 deletion sdk/framework/openapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,6 @@ func testPath(t *testing.T, path *Path, sp *logical.Paths, expectedJSON string)
if err != nil {
t.Fatal(err)
}

// Compare json by first decoding, then comparing with a deep equality check.
var expected, actual interface{}
if err := jsonutil.DecodeJSON(docJSON, &actual); err != nil {
Expand Down
140 changes: 82 additions & 58 deletions sdk/framework/testdata/operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,7 @@
"paths": {
"/foo/{id}": {
"description": "Synopsis",
"x-vault-createSupported": true,
"x-vault-sudo": true,
"x-vault-displayAttrs": {
"navigation": true
},
"parameters": [
{
"name": "format",
"description": "a query param",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "id",
"description": "id path parameter",
Expand All @@ -36,26 +23,41 @@
"required": true
}
],
"x-vault-sudo": true,
"x-vault-createSupported": true,
"x-vault-displayAttrs": {
"navigation": true
},
"get": {
"summary": "My Summary",
"description": "My Description",
"operationId": "kv-read-foo-id",
"tags": [
"secrets"
],
"summary": "My Summary",
"description": "My Description",
"parameters": [
{
"name": "format",
"description": "a query param",
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"summary": "Update Summary",
"description": "Update Description",
"operationId": "kv-write-foo-id",
"tags": [
"secrets"
],
"summary": "Update Summary",
"description": "Update Description",
"requestBody": {
"required": true,
"content": {
Expand All @@ -75,19 +77,7 @@
},
"/foo/{id}/": {
"description": "Synopsis",
"x-vault-sudo": true,
"x-vault-displayAttrs": {
"navigation": true
},
"parameters": [
{
"name": "format",
"description": "a query param",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "id",
"description": "id path parameter",
Expand All @@ -98,50 +88,59 @@
"required": true
}
],
"x-vault-sudo": true,
"x-vault-displayAttrs": {
"navigation": true
},
"get": {
"summary": "List Summary",
"description": "List Description",
"operationId": "kv-list-foo-id",
"tags": [
"secrets"
],
"summary": "List Summary",
"description": "List Description",
"responses": {
"200": {
"description": "OK"
}
},
"parameters": [
{
"name": "format",
"description": "a query param",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "list",
"description": "Must be set to `true`",
"required": true,
"in": "query",
"schema": {
"type": "string",
"enum": [
"true"
]
},
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StandardListResponse"
}
}
}
}
]
}
}
}
},
"components": {
"schemas": {
"KvWriteFooIdRequest": {
"type": "object",
"required": [
"age"
],
"properties": {
"flavors": {
"type": "array",
"description": "the flavors",
"items": {
"type": "string"
}
},
"age": {
"type": "integer",
"description": "the age",
Expand All @@ -152,16 +151,32 @@
],
"x-vault-displayAttrs": {
"name": "Age",
"value": 7,
"sensitive": true,
"group": "Some Group",
"value": 7
"group": "Some Group"
}
},
"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": {
"type": "string",
"description": "the name",
"default": "Larry",
"pattern": "\\w([\\w-.]*\\w)?"
"pattern": "\\w([\\w-.]*\\w)?",
"default": "Larry"
},
"x-abc-token": {
"type": "string",
Expand All @@ -171,14 +186,23 @@
"b",
"c"
]
},
"maximum": {
"type": "integer",
"description": "a maximum value",
"format": "int64"
}
},
"required": [
"age"
]
},
"StandardListResponse": {
"type": "object",
"properties": {
"keys": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
Loading

0 comments on commit 400b3b3

Please sign in to comment.