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

Add .circleci/config.yml #219

Merged
merged 1 commit into from
Jun 28, 2021
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
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2.1
jobs:
build:
working_directory: ~/repo
docker:
- image: circleci/golang:1.16.5
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: go mod download
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: Run tests
command: |
set -x
go test -covermode atomic -race -timeout 120s -parallel 4 -coverprofile ./coverage.out $(go list ./...)
cov="$(go tool cover -func coverage.out | grep -v 100.0% || true)"
echo $cov
test -z "$cov"
33 changes: 33 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.30
# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

23 changes: 16 additions & 7 deletions sfxclient/sfxclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestScheduler_ReportingTimeout(t *testing.T) {
tk := timekeepertest.NewStubClock(time.Now())
s.Timer = tk

ctx := context.Background()
ctx, cancel := context.WithCancel(context.Background())
Convey("testing longer processing time for ReportOnce", t, func() {
s.ReportingTimeout(time.Nanosecond)
setupCollectors(250 * 10)
Expand All @@ -118,6 +118,7 @@ func TestScheduler_ReportingTimeout(t *testing.T) {
tk.Incr(time.Duration(s.ReportingDelayNs))
runtime.Gosched()
}
cancel()
So(atomic.LoadInt64(&s.stats.reportingTimeoutCounts), ShouldEqual, int64(1))
})
}
Expand All @@ -140,18 +141,26 @@ func TestCollectDatapointDebug(t *testing.T) {
tk := timekeepertest.NewStubClock(time.Now())
s.Timer = tk

ctx := context.Background()
ctx, cancel := context.WithCancel(context.Background())
Convey("testing collect datapoints with debug mode enabled", t, func() {
s.Debug(true)
s.AddCallback(GoMetricsSource)
s.AddGroupedCallback("goMetrics", GoMetricsSource)
go s.Schedule(ctx)
for atomic.LoadInt64(&s.stats.scheduledSleepCounts) == 0 {
runtime.Gosched()
tk.Incr(time.Duration(s.ReportingDelayNs))
runtime.Gosched()
}
go func() {
for {
runtime.Gosched()
tk.Incr(time.Duration(s.ReportingDelayNs))
runtime.Gosched()
select {
case <-ctx.Done():
return
default:
}
}
}()
dps := <-sink.lastDatapoints
cancel()
So(len(dps), ShouldEqual, 60)
})
}
Expand Down