Skip to content

Commit

Permalink
Merge pull request #632 from hashicorp/dnephin/update-ci
Browse files Browse the repository at this point in the history
ci: use latest Go version and fix a flaky test
  • Loading branch information
dnephin authored Jun 9, 2021
2 parents 286605e + ac85eef commit 6b5b700
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
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

0 comments on commit 6b5b700

Please sign in to comment.