Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 37 additions & 39 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
run:
build-tags:
- generator

version: "2"
linters:
disable-all: true
default: none
enable:
- durationcheck
- copyloopvar
- errcheck
- errname
- errorlint
- forbidigo
- forcetypeassert
- gocognit
- goconst
- gocyclo
- gofmt
- goimports
- mnd
- gosec
- gosimple
- gocritic
- govet
- importas
- ineffassign
- makezero
- misspell
- mnd
- nakedret
- nestif
- nilerr
- nolintlint
- prealloc
- revive
- staticcheck
- typecheck
- unconvert
- unused
- whitespace

linters-settings:
gocognit:
min-complexity: 25
goconst:
min-len: 2
min-occurrences: 2
govet:
enable-all: true
disable:
- fieldalignment
lll:
line-length: 120
tab-width: 4

issues:
exclude-use-default: false
- testifylint
settings:
govet:
disable:
- fieldalignment
- shadow
enable-all: true
staticcheck:
checks: ["all", "-QF1008"]
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- dupl
- goconst
- golint
- gosec
path: _test\.go
text: underscore
- linters:
- staticcheck
text: "QF1001: (.*)"
formatters:
enable:
- gofmt
- gofumpt
- goimports
1 change: 1 addition & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
template: testify
filename: "{{ .InterfaceName | lower }}_mock.go"
formatter: goimports
include-auto-generated: true
packages:
github.com/aiven/go-client-codegen:
interfaces:
Expand Down
2 changes: 1 addition & 1 deletion .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ lint:
- checkov@3.2.495
- git-diff-check
- gofmt@1.20.4
- golangci-lint@2.7.2
- golangci-lint2@2.7.2
- markdownlint@0.47.0
- osv-scanner@2.3.1
- prettier@3.7.4
Expand Down
1 change: 1 addition & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ tasks:
- task: get-openapi-spec
- task: go-generate
- task: generate-mocks
- task: fmt-imports
test:
cmds:
- go test -v
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func fmtQuery(operationID string, query ...[2]string) string {

// shouldAddDefaultLimit determines if default limit should be added
func shouldAddDefaultLimit(operationID string, q url.Values) bool {
var operationsWithoutLimit = []string{
operationsWithoutLimit := []string{
"ServiceKafkaQuotaDescribe",
"ServiceKafkaQuotaDelete",
}
Expand Down
3 changes: 2 additions & 1 deletion client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ func TestServiceCreate(t *testing.T) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, err = w.Write([]byte(`{"service": {"plan": "wow", "state": "RUNNING"}}`))
require.NoError(t, err)
assert.NoError(t, err)
atomic.AddInt64(&callCount, 1)
},
)
mux.HandleFunc(
"/v1/project/aiven-project/service/my-clickhouse/clickhouse/query/stats",
func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.URL.RawQuery, "limit=1&order_by=max_time%3Aasc")
assert.Equal(t, "limit=1&order_by=max_time%3Aasc", r.URL.RawQuery)

// Creates response
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, err := w.Write([]byte(`{"queries": [{"calls": 1}]}`))
require.NoError(t, err)
assert.NoError(t, err)
atomic.AddInt64(&callCount, 1)
},
)
Expand Down Expand Up @@ -160,7 +160,7 @@ func TestServiceCreateErrorsRetries(t *testing.T) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
_, err := w.Write([]byte(tt.ResponseBody))
require.NoError(t, err)
assert.NoError(t, err)
atomic.AddInt64(&callsActual, 1)
},
)
Expand Down Expand Up @@ -270,13 +270,13 @@ func TestServiceIntegrationEndpointGet(t *testing.T) {
"/v1/project/{project}/integration_endpoint/{integration_endpoint_id}",
func(w http.ResponseWriter, r *http.Request) {
assert.Regexp(t, `go-client-codegen/[0-9\.]+ unit-test`, r.Header["User-Agent"])
assert.Equal(t, r.RequestURI, "/v1/project/aiven-endpoint-project/integration_endpoint/foo?include_secrets=true&limit=999")
assert.Equal(t, "/v1/project/aiven-endpoint-project/integration_endpoint/foo?include_secrets=true&limit=999", r.RequestURI)

// Creates response
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, err := w.Write([]byte(`{"service_integration_endpoint": {"endpoint_name": "wow"}}`))
require.NoError(t, err)
assert.NoError(t, err)
atomic.AddInt64(&callCount, 1)
},
)
Expand Down
2 changes: 1 addition & 1 deletion error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestIsNotFoundIntegration(t *testing.T) {
ctx := context.Background()
out, err := c.AccountGet(ctx, "does_not_exist")
assert.Nil(t, out)
assert.NotNil(t, err)
require.Error(t, err)
assert.True(t, IsNotFound(err))
}

Expand Down
30 changes: 12 additions & 18 deletions handler/kafkaconnect/kafkaconnect.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions openapi_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,29 @@ components:
additionalProperties: true
ServiceKafkaConnectEditConnectorRequestBody:
additionalProperties: true
ServiceKafkaConnectListResponse:
properties:
connectors:
items:
properties:
# config has dynamic keys, with more fields than documented in a spec
config:
additionalProperties:
type: string
ServiceKafkaConnectCreateConnectorResponse:
properties:
connector:
properties:
config:
additionalProperties:
type: string
ServiceKafkaConnectEditConnectorResponse:
properties:
connector:
properties:
config:
additionalProperties:
type: string
ServiceClickHousePasswordResetRequestBody:
properties:
password:
Expand Down