Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix golangci-lint #1042

Merged
merged 1 commit into from
May 22, 2024
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
19 changes: 8 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ jobs:
name: "[core] lint"
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v1
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
run: go get -v -t -d ./...
- name: Get golangci-lint
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.57.2
- name: Lint
run: $(go env GOPATH)/bin/golangci-lint run --timeout 10m0s ./...
go-version: '1.21'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58.1
args: --timeout=10m

test-core:
name: "[core] gnomock, gnomockd"
Expand Down
32 changes: 20 additions & 12 deletions preset/kafka/preset.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,29 @@ func (p *P) healthcheck(ctx context.Context, c *gnomock.Container) (err error) {
}

if p.UseSchemaRegistry {
url := "http://" + c.Address(SchemaRegistryPort)

req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return fmt.Errorf("invalid request: %w", err)
if err := p.healthcheckRegistry(ctx, c); err != nil {
return err
}
}

res, err := http.DefaultClient.Do(req)
if err != nil {
return fmt.Errorf("schema registry is not available: %w", err)
}
return nil
}

if err := res.Body.Close(); err != nil {
return fmt.Errorf("error closing schema registry response body: %w", err)
}
func (p *P) healthcheckRegistry(ctx context.Context, c *gnomock.Container) error {
url := "http://" + c.Address(SchemaRegistryPort)

req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return fmt.Errorf("invalid request: %w", err)
}

res, err := http.DefaultClient.Do(req)
if err != nil {
return fmt.Errorf("schema registry is not available: %w", err)
}

if err := res.Body.Close(); err != nil {
return fmt.Errorf("error closing schema registry response body: %w", err)
}

return nil
Expand Down
Loading