Skip to content
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
45 changes: 45 additions & 0 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:

jobs:
basics:
strategy:
fail-fast: false
matrix:
os:
- runsOn: macos-latest
mongodb_distro: mongodb-macos-arm64

- runsOn: ubuntu-latest
mongodb_distro: mongodb-linux-x86_64-ubuntu1804

go_version:

# This is hard-coded by design in order to catch inadvertent changes
# to the minimum-required Go version to build migration-verifier.
- 1.19
- stable

runs-on: ${{matrix.os.runsOn}}

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Fetch Go ${{ matrix.go_version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}

- name: Build
run: go build main/migration_verifier.go

- name: Test
run: go test -v ./...
env:
MONGODB_DISTRO: ${{matrix.os.mongodb_distro}}
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/10gen/migration-verifier

go 1.18
go 1.19

require (
github.com/deckarep/golang-set/v2 v2.3.0
Expand Down
3 changes: 2 additions & 1 deletion internal/verifier/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ func (verifier *Verifier) MaybeStartPeriodicHeapProfileCollection(ctx context.Co
func collectHeapUsage() {
heapFileName := fmt.Sprintf("heap-%s.out", time.Now().UTC().Format("20060102T150405Z"))
heapFile, err := os.Create(heapFileName)
defer heapFile.Close()

if err != nil {
panic(err)
}

defer heapFile.Close()

err = pprof.Lookup("heap").WriteTo(heapFile, 0)
if err != nil {
panic(err)
Expand Down
9 changes: 5 additions & 4 deletions main/migration_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ func handleArgs(ctx context.Context, cCtx *cli.Context) (*verifier.Verifier, err
v.SetNumWorkers(cCtx.Int(numWorkers))
v.SetGenerationPauseDelayMillis(time.Duration(cCtx.Int64(generationPauseDelay)))
v.SetWorkerSleepDelayMillis(time.Duration(cCtx.Int64(workerSleepDelay)))
v.SetPprofInterval(cCtx.String(pprofInterval))

err = v.SetPprofInterval(cCtx.String(pprofInterval))
if err != nil {
return nil, err
}

partitionSizeMB := cCtx.Uint64(partitionSizeMB)
if partitionSizeMB != 0 {
Expand All @@ -226,9 +230,6 @@ func handleArgs(ctx context.Context, cCtx *cli.Context) (*verifier.Verifier, err
v.SetStartClean(cCtx.Bool(startClean))
logPath := cCtx.String(logPath)
v.SetLogger(logPath)
if err != nil {
return nil, err
}
if cCtx.Bool(verifyAll) {
if len(cCtx.StringSlice(srcNamespace)) > 0 || len(cCtx.StringSlice(dstNamespace)) > 0 {
return nil, errors.Errorf("Setting both verifyAll and explicit namespaces is not supported")
Expand Down
Loading