Skip to content

Commit

Permalink
Merge branch 'main' into batch_sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
kropidlowsky authored Mar 13, 2024
2 parents 8099fc2 + 346fe7a commit a6f8dfd
Show file tree
Hide file tree
Showing 116 changed files with 2,745 additions and 4,359 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
!.gitignore

# additional files for Docker images
!build/docker
!build/ferretdb
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ updates:
time: "01:42"

- package-ecosystem: "docker"
directory: "/build/docker"
directory: "/build/ferretdb"
labels: ["deps", "not ready"]
assignees: [AlekSi]
open-pull-requests-limit: 20
Expand Down
20 changes: 7 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,24 @@ linters-settings:
desc: use `github.com/jackc/pgx/v5` package instead
- pkg: github.com/jackc/pgx/v4
desc: use `github.com/jackc/pgx/v5` package instead
fjson:
# TODO https://github.com/FerretDB/FerretDB/issues/4157
oldbson:
files:
- $all
- "!**/internal/bson/*_test.go"
- "!**/internal/util/testutil/*.go"
- "!**/internal/bson/bson_test.go"
deny:
- pkg: github.com/FerretDB/FerretDB/internal/types/fjson
- pkg: github.com/FerretDB/FerretDB/internal/bson/oldbson$
bson:
files:
- $all
- "!**/internal/bson2/*_test.go"
deny:
- pkg: github.com/FerretDB/FerretDB/internal/bson$
bson2:
files:
- $all
- "!**/internal/bson/*_test.go"
- "!**/internal/util/testutil/*.go"
- "!**/internal/wire/*.go"
deny:
- pkg: github.com/FerretDB/FerretDB/internal/bson2
- pkg: github.com/FerretDB/FerretDB/internal/bson
bsonproto:
files:
- $all
- "!**/internal/bson2/*.go"
- "!**/internal/bson/*.go"
deny:
- pkg: github.com/cristalhq/bson
- pkg: github.com/cristalhq/bson/bsonproto
Expand Down
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ The `internal` subpackages contain most of the FerretDB code:

- `types` package provides Go types matching BSON types that don't have built-in Go equivalents:
we use `int32` for BSON's int32, but `types.ObjectID` for BSON's ObjectId.
- `types/fjson` provides converters from/to FJSON for built-in and `types` types.
It is used for logging of BSON values and wire protocol messages.
- `bson` package provides converters from/to BSON for built-in and `types` types.
- `wire` package provides wire protocol implementation.
- `clientconn` package provides client connection implementation.
Expand Down
26 changes: 13 additions & 13 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ tasks:
desc: "Run unit benchmarks"
cmds:
- go test -list='Benchmark.*' ./...
- go test -count=10 -bench=BenchmarkDocument -benchtime={{.BENCH_TIME}} ./internal/bson2/ | tee -a new.txt
- go test -count=10 -bench=BenchmarkDocument -benchtime={{.BENCH_TIME}} ./internal/bson/ | tee -a new.txt
- bin/benchstat{{exeExt}} old.txt new.txt

# That's not quite correct: https://github.com/golang/go/issues/15513
Expand All @@ -340,7 +340,7 @@ tasks:
desc: "Fuzz for about 1 minute (with default FUZZ_TIME)"
cmds:
- go test -list='Fuzz.*' ./...
- go test -run=XXX -fuzz=FuzzDocument -fuzztime={{.FUZZ_TIME}} ./internal/bson2/
- go test -run=XXX -fuzz=FuzzDocument -fuzztime={{.FUZZ_TIME}} ./internal/bson/
- go test -run=XXX -fuzz=FuzzMsg -fuzztime={{.FUZZ_TIME}} ./internal/wire/
- go test -run=XXX -fuzz=FuzzQuery -fuzztime={{.FUZZ_TIME}} ./internal/wire/
- go test -run=XXX -fuzz=FuzzReply -fuzztime={{.FUZZ_TIME}} ./internal/wire/
Expand Down Expand Up @@ -571,7 +571,7 @@ tasks:
--name=ferretdb
--bootstrap=true
--use=false
--config=./build/docker/buildkitd.toml
--config=./build/buildkitd.toml
--driver=docker-container
--driver-opt network=host
--driver-opt env.JAEGER_TRACE=127.0.0.1:6831
Expand All @@ -595,7 +595,7 @@ tasks:
cmds:
- >
docker buildx build --builder=ferretdb
--file=build/docker/{{.FILE}}.Dockerfile
--file=build/{{.FILE}}.Dockerfile
--build-arg=LABEL_VERSION={{.VERSION}}
--build-arg=LABEL_COMMIT={{.COMMIT}}
--target={{.TARGET}}
Expand Down Expand Up @@ -628,7 +628,7 @@ tasks:
- bin/envtool{{exeExt}} shell mkdir tmp/bin-dev
- task: docker-build
vars:
FILE: development
FILE: ferretdb/development
TARGET: development-binary
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=local,dest=tmp/build
Expand All @@ -648,7 +648,7 @@ tasks:
- bin/envtool{{exeExt}} shell mkdir tmp/bin
- task: docker-build
vars:
FILE: production
FILE: ferretdb/production
TARGET: production-binary
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=local,dest=tmp/build
Expand Down Expand Up @@ -678,7 +678,7 @@ tasks:
- echo 'docker-all-in-one' > build/version/package.txt
- task: docker-build
vars:
FILE: all-in-one
FILE: ferretdb/all-in-one
TARGET: all-in-one
PLATFORM: linux/amd64,linux/arm64 # no mongosh for arm/v6 and arm/v7
OUTPUT: type=image,push=true
Expand All @@ -691,7 +691,7 @@ tasks:
- echo 'docker-development' > build/version/package.txt
- task: docker-build
vars:
FILE: development
FILE: ferretdb/development
TARGET: development
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=image,push=true
Expand All @@ -704,7 +704,7 @@ tasks:
- echo 'docker' > build/version/package.txt
- task: docker-build
vars:
FILE: production
FILE: ferretdb/production
TARGET: production
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=image,push=true
Expand Down Expand Up @@ -753,7 +753,7 @@ tasks:
- bin/envtool{{exeExt}} shell mkdir tmp/debs
- task: docker-build
vars:
FILE: development
FILE: ferretdb/development
TARGET: development-binary
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=local,dest=tmp/build
Expand Down Expand Up @@ -781,7 +781,7 @@ tasks:
- bin/envtool{{exeExt}} shell mkdir tmp/debs
- task: docker-build
vars:
FILE: production
FILE: ferretdb/production
TARGET: production-binary
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=local,dest=tmp/build
Expand Down Expand Up @@ -821,7 +821,7 @@ tasks:
- bin/envtool{{exeExt}} shell mkdir tmp/rpms
- task: docker-build
vars:
FILE: development
FILE: ferretdb/development
TARGET: development-binary
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=local,dest=tmp/build
Expand Down Expand Up @@ -849,7 +849,7 @@ tasks:
- bin/envtool{{exeExt}} shell mkdir tmp/rpms
- task: docker-build
vars:
FILE: production
FILE: ferretdb/production
TARGET: production-binary
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 # TODO https://github.com/FerretDB/FerretDB/issues/3354
OUTPUT: type=local,dest=tmp/build
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ RUN mkdir /tmp/cover

# all-in-one hacks start there

COPY --from=all-in-one-build /src/build/docker/all-in-one/ferretdb.sh /etc/service/ferretdb/run
COPY --from=all-in-one-build /src/build/docker/all-in-one/postgresql.sh /etc/service/postgresql/run
COPY --from=all-in-one-build /src/build/docker/all-in-one/entrypoint.sh /entrypoint.sh
COPY --from=all-in-one-build /src/build/ferretdb/all-in-one/ferretdb.sh /etc/service/ferretdb/run
COPY --from=all-in-one-build /src/build/ferretdb/all-in-one/postgresql.sh /etc/service/postgresql/run
COPY --from=all-in-one-build /src/build/ferretdb/all-in-one/entrypoint.sh /entrypoint.sh

RUN --mount=type=cache,sharing=locked,target=/var/cache/apt <<EOF
set -ex
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ FROM scratch AS production
COPY --from=production-build /src/bin/ferretdb /ferretdb

# TODO https://github.com/FerretDB/FerretDB/issues/3992
# COPY build/docker/passwd /etc/passwd
# COPY build/docker/group /etc/group
# COPY build/ferretdb/passwd /etc/passwd
# COPY build/ferretdb/group /etc/group
# USER ferretdb:ferretdb

ENTRYPOINT [ "/ferretdb" ]
Expand Down
14 changes: 9 additions & 5 deletions integration/users/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,15 @@ func TestAuthenticationLocalhostException(tt *testing.T) {
{"mechanisms", bson.A{mechanism}},
}
err = db.RunCommand(ctx, secondUser).Err()
integration.AssertEqualCommandError(t, mongo.CommandError{
Code: 18,
Name: "AuthenticationFailed",
Message: "Authentication failed",
}, err)
integration.AssertEqualCommandError(
t,
mongo.CommandError{
Code: 18,
Name: "AuthenticationFailed",
Message: "Authentication failed",
},
err,
)

credential := options.Credential{
AuthMechanism: mechanism,
Expand Down
Loading

0 comments on commit a6f8dfd

Please sign in to comment.