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

ci: use latest Go version and fix a flaky test #632

Merged
merged 4 commits into from
Jun 9, 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
20 changes: 1 addition & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2.1
executors:
go:
docker:
- image: docker.mirror.hashicorp.services/circleci/golang:1.14.1
- image: docker.mirror.hashicorp.services/circleci/golang:1.16
environment:
- TEST_RESULTS: /tmp/test-results # path to where test results are saved

Expand All @@ -13,20 +13,8 @@ jobs:
executor: go
steps:
- checkout

# Restore go module cache if there is one
- restore_cache:
keys:
- serf-modcache-v1-{{ checksum "go.mod" }}

- run: go mod download

# Save go module cache if the go.mod file has changed
- save_cache:
key: serf-modcache-v1-{{ checksum "go.mod" }}
paths:
- "/go/pkg/mod"

# check go fmt output because it does not report non-zero when there are fmt changes
- run:
name: check go fmt
Expand All @@ -45,12 +33,6 @@ jobs:
- checkout
- run: mkdir -p $TEST_RESULTS
- run: make bin

# Restore go module cache if there is one
- restore_cache:
keys:
- serf-modcache-v1-{{ checksum "go.mod" }}

- run: sudo apt-get update && sudo apt-get install -y rsyslog
- run: sudo service rsyslog start
# run go tests with gotestsum
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
echo "==> Building..."
gox \
-os="${XC_OS}" \
-osarch="!darwin/arm" \
-osarch="!darwin/arm !darwin/386" \
-arch="${XC_ARCH}" \
-ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}${GIT_DIRTY}'" \
-output "pkg/{{.OS}}_{{.Arch}}/serf" \
Expand Down
1 change: 1 addition & 0 deletions serf/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
// testEvents tests that the given node had the given sequence of events
// on the event channel.
func testEvents(t *testing.T, ch <-chan Event, node string, expected []EventType) {
t.Helper()
actual := make([]EventType, 0, len(expected))

TESTEVENTLOOP:
Expand Down
14 changes: 8 additions & 6 deletions serf/serf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func TestSerf_RemoveFailed_eventsLeave(t *testing.T) {
t.Fatalf("err: %v", err)
}

time.Sleep(s2Config.MemberlistConfig.ProbeInterval * 3)
time.Sleep(s2Config.MemberlistConfig.ProbeInterval * 5)

if err := s1.RemoveFailedNode(s2Config.NodeName); err != nil {
t.Fatalf("err: %v", err)
Expand Down Expand Up @@ -2034,11 +2034,12 @@ func TestSerf_Query(t *testing.T) {
}
q := e.(*Query)
if err := q.Respond([]byte("test")); err != nil {
t.Fatalf("err: %v", err)
t.Errorf("err: %v", err)
}
return
case <-time.After(time.Second):
t.Fatalf("timeout")
t.Errorf("timeout")
return
}
}
}()
Expand Down Expand Up @@ -2138,11 +2139,12 @@ func TestSerf_Query_Filter(t *testing.T) {
}
q := e.(*Query)
if err := q.Respond([]byte("test")); err != nil {
t.Fatalf("err: %v", err)
t.Errorf("err: %v", err)
}
return
case <-time.After(time.Second):
t.Fatalf("timeout")
t.Errorf("timeout")
return
}
}
}()
Expand Down Expand Up @@ -2948,7 +2950,7 @@ func waitUntilNumNodes(t *testing.T, desiredNodes int, serfs ...*Serf) {
t.Helper()
for i, s := range serfs {
if n := s.NumNodes(); desiredNodes != n {
r.Fatalf("s%d got %d expected %d", (i + 1), n, desiredNodes)
r.Fatalf("s%d got %d expected %d", i+1, n, desiredNodes)
}
}
})
Expand Down