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

Tests fix #406

Merged
merged 4 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ on:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
version: v1.38.0

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:

tests:
name: Test code
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
go:
- ^1.13
- ^1.14
- ^1.15
- ^1.16
- ^1
steps:

Expand Down
8 changes: 5 additions & 3 deletions api/sample/cache-query/cache-query.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ func main() {
timeout := flag.Duration("timeout", time.Second, "connect and read timeout")
flag.Parse()

// TODO: grpc.WithTimeout deprecated
conn, err := grpc.Dial(*server, grpc.WithInsecure(), grpc.WithTimeout(*timeout)) //nolint:staticcheck skipcq:SCC-SA1019
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
conn, err := grpc.DialContext(ctx, *server, grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
log.Fatalf("did not connect: %v", err)
}

defer cancel()
defer conn.Close()

c := carbonpb.NewCarbonClient(conn)

ctx, cancel := context.WithTimeout(context.Background(), *timeout)
ctx, cancel = context.WithTimeout(context.Background(), *timeout)
defer cancel()

res, err := c.CacheQuery(ctx, &carbonpb.CacheRequest{Metrics: flag.Args()})
Expand Down
2 changes: 1 addition & 1 deletion carbonserver/carbonserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ func (listener *CarbonserverListener) updateFileList(dir string, cacheMetricName

var freeSpace uint64
// diskspace can be negative and Bavail is therefore int64
if stat.Bavail >= 0 { // nolint:staticcheck skipcq: SCC-SA4003
if stat.Bavail >= 0 { // nolint:staticcheck // skipcq: SCC-SA4003
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not me, but golangci-lint 1.38
But still dunno why "TestThrottleChan" failing, it's working on my laptop :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test seems to be a bit unstable. Sometimes it passed, sometimes it failed.
I think we can try modify the 0.95 to 0.9.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I could re-phase it as the current newThrottleTicker can't meet the [0.95, 1.05] range 100% of the time. :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange, for me it's failing 100% on GHA and passing 100% on my laptop. Trying 90%-110% range now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, working now, merging

freeSpace = uint64(stat.Bavail) * uint64(stat.Bsize)
}
totalSpace := stat.Blocks * uint64(stat.Bsize)
Expand Down