Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Sep 14, 2024
1 parent a0c287e commit b145321
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 28 deletions.
16 changes: 8 additions & 8 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ functions:
go install github.com/go-task/task/v3/cmd/task@latest
# Install libmongocrypt.
bash etc/install-libmongocrypt.sh
task install-libmongocrypt
if [ "Windows_NT" = "$OS" ]; then
export PATH=$PATH:/cygdrive/c/libmongocrypt/bin
fi
Expand Down Expand Up @@ -279,7 +279,7 @@ functions:
script: |
${PREPARE_SHELL}
export OIDC="oidc"
bash ${PROJECT_DIRECTORY}/etc/run-oidc-test.sh 'task --silent evg-test-oidc-auth'
task test-oidc
run-task:
- command: shell.exec
Expand Down Expand Up @@ -312,7 +312,7 @@ functions:
${PREPARE_SHELL}
export BASE_SHA=${revision}
export HEAD_SHA=${github_commit}
bash etc/api_report.sh
task api-report
"add PR labels":
- command: shell.exec
Expand Down Expand Up @@ -394,7 +394,7 @@ functions:
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
script: |
${PREPARE_SHELL}
bash etc/run-atlas-test.sh
task run-atlas
run-ocsp-test:
- command: shell.exec
Expand Down Expand Up @@ -525,8 +525,8 @@ functions:
working_dir: src/go.mongodb.org/mongo-driver
script: |
${PREPARE_SHELL}
bash etc/run_docker.sh
TOPOLOGY=sharded_cluster bash etc/run_docker.sh test-short
task run-docker
TOPOLOGY=sharded_cluster task run-docker -- test-short
run-valid-ocsp-server:
- command: shell.exec
Expand Down Expand Up @@ -1780,7 +1780,7 @@ tasks:
working_dir: src/go.mongodb.org/mongo-driver
script: |
${PREPARE_SHELL}
bash etc/run-awskms-test.sh
task test-awskms
- name: "testawskms-fail-task"
# testawskms-fail-task runs without environment variables.
Expand All @@ -1794,7 +1794,7 @@ tasks:
script: |
${PREPARE_SHELL}
export EXPECT_ERROR='status=400'
bash etc/run-awskms-test.sh
task test-awskms
- name: "testazurekms-task"
commands:
Expand Down
53 changes: 38 additions & 15 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:

tasks:

### Utility targets. ###
### Utility tasks. ###
default:
deps: [build, check-license, check-fmt, check-modules, lint, test-short]

Expand All @@ -33,8 +33,6 @@ tasks:
- GOOS=linux GOARCH=ppc64le go build ./...
- GOOS=linux GOARCH=s390x go build ./...

install-lll: go install github.com/walle/lll/...@latest

check-fmt:
deps: [install-lll]
cmds:
Expand All @@ -46,12 +44,15 @@ tasks:

fmt: go fmt ./...

# NOTE: A golangci-lint version is also pinned in .pre-commit-config.yaml. Make
# sure to change it there to keep it in-sync with what's used here!
install-golangci-lint:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1
api-report: etc/api_report.sh

install-libmongocrypt: etc/install-libmongocrypt.sh

# Lint with various GOOS and GOARCH targets to catch static analysis failures that may only affect
run-docker: etc/run_docker.sh

cherry-picker: etc/cherry-picker.sh

# Lint with various GOOS and GOARCH tasks to catch static analysis failures that may only affect
# specific operating systems or architectures. For example, staticcheck will only check for 64-bit
# alignment of atomically accessed variables on 32-bit architectures (see
# https://staticcheck.io/docs/checks#SA1027)
Expand All @@ -67,7 +68,7 @@ tasks:

update-notices: etc/generate_notices.pl > THIRD-PARTY-NOTICES

### Local testing targets. ###
### Local testing tasks. ###
test: go test ${BUILD_TAGS} -timeout {{.TEST_TIMEOUT}}s -p 1 ./...

test-cover:
Expand All @@ -78,14 +79,20 @@ tasks:

test-short: go test ${BUILD_TAGS} -timeout 60s -short ./...

### Local FaaS targets. ###
test-oidc: etc/run-oidc-test.sh 'task --silent evg-test-oidc-auth'

test-atlas: etc/run-atlas-test.sh

test-awskms: etc/run-awskms-test.sh

### Local FaaS tasks. ###
build-faas-awslambda:
requires:
vars: [MONGODB_URI]
cmds:
- make -c internal/cmd/faas/awslambda

### Evergreen specific targets. ###
### Evergreen specific tasks. ###
build-aws-ecs-test: go build ${BUILD_TAGS} ./internal/cmd/testaws/main.go

evg-test:
Expand Down Expand Up @@ -160,15 +167,31 @@ tasks:

build-kms-test: go build ${BUILD_TAGS} ./internal/cmd/testkms

### Benchmark specific targets and support. ###
### Benchmark specific tasks and support. ###
benchmark:
deps: [perf]
deps: [perf-files]
cmds:
- go test ${BUILD_TAGS} -benchmem -bench=. ./benchmark | test benchmark.suite

driver-benchmark:
deps: [perf]
deps: [perf-files]
cmds:
- go run ./internal/cmd/benchmark | tee perf.suite

perf: etc/prep-perf.sh
### Internal tasks. ###
perf-files:
internal: true
cmds:
- etc/prep-perf.sh

install-lll:
internal: true
cmds:
- go install github.com/walle/lll/...@latest

# NOTE: A golangci-lint version is also pinned in .pre-commit-config.yaml. Make
# sure to change it there to keep it in-sync with what's used here!
install-golangci-lint:
internal: true
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1
10 changes: 5 additions & 5 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ git config --global github.user <github_handle>
If a Pull Request needs to be cherry-picked to a new branch, get the sha of the commit in the base branch, and then run

```bash
bash etc/cherry-picker.sh <sha>
task cherry-picker -- <sha>
```

By default it will use `master` as the target branch. The branch can be specified as the second argument, e.g.

```bash
bash etc/cherry-picker.sh <sha> branch
task cherry-picker -- <sha> branch
```

It will create a new checkout in a temp dir, create a new branch, perform the cherry-pick, and then
Expand All @@ -91,7 +91,7 @@ prompt before creating a PR to the target branch.

The driver tests can be run against several database configurations. The most simple configuration is a standalone mongod with no auth, no ssl, and no compression. To run these basic driver tests, make sure a standalone MongoDB server instance is running at localhost:27017. To run the tests, you can run `task`. This will run coverage, run go-lint, run go-vet, and build the examples.

You can install `libmongocrypt` locally by running `bash etc/build-libmongocrypt.sh`, which will create an `install` directory
You can install `libmongocrypt` locally by running `task install-libmongocrypt`, which will create an `install` directory
in the repository top level directory. On Windows you will also need to add `c:/libmongocrypt/` to your `PATH`.

### Testing Different Topologies
Expand Down Expand Up @@ -227,7 +227,7 @@ See the readme in `$DRIVERS_TOOLS/.evergreen/docker` for more information on usa
1. Finally, run the Go Driver tests using the following script in this repo:

```bash
bash etc/run_docker.sh
make run-docker
```

The script takes an optional argument for the `TASKFILE_TARGET` and allows for some environment variable overrides.
Expand All @@ -238,7 +238,7 @@ For example, to test against a sharded cluster (make sure you started the server
using enterprise auth, run:

```bash
TOPOLOGY=sharded_cluster bash etc/run_docker.sh evg-test-enterprise-auth
TOPOLOGY=sharded_cluster task run-docker -- evg-test-enterprise-auth
```

## Talk To Us
Expand Down
5 changes: 5 additions & 0 deletions etc/prep-perf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# Prepares perf data.
set -eux

if [ -d /testdata/perf/ ]; then
echo "/testdata/perf/ already exists, skipping download"
exit 0
fi

curl --retry 5 "https://s3.amazonaws.com/boxes.10gen.com/build/driver-test-data.tar.gz" -o driver-test-data.tar.gz --silent --max-time 120

if [ $(uname -s) == "Darwin" ]; then
Expand Down

0 comments on commit b145321

Please sign in to comment.