Skip to content

Commit

Permalink
Small fixes and tweaks (#3971)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi authored Jan 12, 2024
1 parent 0804f2b commit 3eb9ee6
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pull_request_rules:
- name: "Update out-of-date approved PRs"
conditions:
# those rules are implicit for the update action:
# - "#commits-behind > 0"
# - "-closed"
- "-conflict"
# - "-conflict"
# - "#commits-behind > 0"
- "-draft"
- "-locked"
- "-merged"
Expand Down
2 changes: 1 addition & 1 deletion internal/bson/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (doc *Document) readNested(r *bufio.Reader, nesting int) error {
if t == 0 {
// documented ended
if _, err := bufr.Peek(1); err != io.EOF {
return lazyerrors.Errorf("unexpected end of the document: %w", err)
return lazyerrors.Errorf("unexpected end of the document: %v", err)
}
break
}
Expand Down
8 changes: 8 additions & 0 deletions internal/bson/document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ var (
all = testCase{
name: "all",
v: must.NotFail(ConvertDocument(must.NotFail(types.NewDocument(
"array", must.NotFail(types.NewArray(
must.NotFail(types.NewArray("")),
must.NotFail(types.NewArray("foo")),
)),
"binary", must.NotFail(types.NewArray(
types.Binary{Subtype: types.BinaryUser, B: []byte{0x42}},
types.Binary{Subtype: types.BinaryGeneric, B: []byte{}},
Expand All @@ -152,6 +156,10 @@ var (
time.Date(2021, 7, 27, 9, 35, 42, 123000000, time.UTC).Local(),
time.Time{}.Local(),
)),
"document", must.NotFail(types.NewArray(
must.NotFail(types.NewDocument("foo", "")),
must.NotFail(types.NewDocument("", "foo")),
)),
"double", must.NotFail(types.NewArray(42.13, 0.0)),
"int32", must.NotFail(types.NewArray(int32(42), int32(0))),
"int64", must.NotFail(types.NewArray(int64(42), int64(0))),
Expand Down
44 changes: 25 additions & 19 deletions internal/bson/testdata/all.hex
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
00000000 2d 01 00 00 04 62 69 6e 61 72 79 00 16 00 00 00 |-....binary.....|
00000010 05 30 00 01 00 00 00 80 42 05 31 00 00 00 00 00 |.0......B.1.....|
00000020 00 00 04 62 6f 6f 6c 00 0d 00 00 00 08 30 00 01 |...bool......0..|
00000030 08 31 00 00 00 04 64 61 74 65 74 69 6d 65 00 1b |.1....datetime..|
00000040 00 00 00 09 30 00 2b e6 51 e7 7a 01 00 00 09 31 |....0.+.Q.z....1|
00000050 00 00 28 d3 ed 7c c7 ff ff 00 04 64 6f 75 62 6c |..(..|.....doubl|
00000060 65 00 1b 00 00 00 01 30 00 71 3d 0a d7 a3 10 45 |e......0.q=....E|
00000070 40 01 31 00 00 00 00 00 00 00 00 00 00 04 69 6e |@.1...........in|
00000080 74 33 32 00 13 00 00 00 10 30 00 2a 00 00 00 10 |t32......0.*....|
00000090 31 00 00 00 00 00 00 04 69 6e 74 36 34 00 1b 00 |1.......int64...|
000000a0 00 00 12 30 00 2a 00 00 00 00 00 00 00 12 31 00 |...0.*........1.|
000000b0 00 00 00 00 00 00 00 00 00 04 6f 62 6a 65 63 74 |..........object|
000000c0 49 44 00 23 00 00 00 07 30 00 42 00 00 00 00 00 |ID.#....0.B.....|
000000d0 00 00 00 00 00 00 07 31 00 00 00 00 00 00 00 00 |.......1........|
000000e0 00 00 00 00 00 00 04 73 74 72 69 6e 67 00 18 00 |.......string...|
000000f0 00 00 02 30 00 04 00 00 00 66 6f 6f 00 02 31 00 |...0.....foo..1.|
00000100 01 00 00 00 00 00 04 74 69 6d 65 73 74 61 6d 70 |.......timestamp|
00000110 00 1b 00 00 00 11 30 00 2a 00 00 00 00 00 00 00 |......0.*.......|
00000120 11 31 00 00 00 00 00 00 00 00 00 00 00 |.1...........|
00000000 8f 01 00 00 04 61 72 72 61 79 00 28 00 00 00 04 |.....array.(....|
00000010 30 00 0d 00 00 00 02 30 00 01 00 00 00 00 00 04 |0......0........|
00000020 31 00 10 00 00 00 02 30 00 04 00 00 00 66 6f 6f |1......0.....foo|
00000030 00 00 00 04 62 69 6e 61 72 79 00 16 00 00 00 05 |....binary......|
00000040 30 00 01 00 00 00 80 42 05 31 00 00 00 00 00 00 |0......B.1......|
00000050 00 04 62 6f 6f 6c 00 0d 00 00 00 08 30 00 01 08 |..bool......0...|
00000060 31 00 00 00 04 64 61 74 65 74 69 6d 65 00 1b 00 |1....datetime...|
00000070 00 00 09 30 00 2b e6 51 e7 7a 01 00 00 09 31 00 |...0.+.Q.z....1.|
00000080 00 28 d3 ed 7c c7 ff ff 00 04 64 6f 63 75 6d 65 |.(..|.....docume|
00000090 6e 74 00 29 00 00 00 03 30 00 0f 00 00 00 02 66 |nt.)....0......f|
000000a0 6f 6f 00 01 00 00 00 00 00 03 31 00 0f 00 00 00 |oo........1.....|
000000b0 02 00 04 00 00 00 66 6f 6f 00 00 00 04 64 6f 75 |......foo....dou|
000000c0 62 6c 65 00 1b 00 00 00 01 30 00 71 3d 0a d7 a3 |ble......0.q=...|
000000d0 10 45 40 01 31 00 00 00 00 00 00 00 00 00 00 04 |.E@.1...........|
000000e0 69 6e 74 33 32 00 13 00 00 00 10 30 00 2a 00 00 |int32......0.*..|
000000f0 00 10 31 00 00 00 00 00 00 04 69 6e 74 36 34 00 |..1.......int64.|
00000100 1b 00 00 00 12 30 00 2a 00 00 00 00 00 00 00 12 |.....0.*........|
00000110 31 00 00 00 00 00 00 00 00 00 00 04 6f 62 6a 65 |1...........obje|
00000120 63 74 49 44 00 23 00 00 00 07 30 00 42 00 00 00 |ctID.#....0.B...|
00000130 00 00 00 00 00 00 00 00 07 31 00 00 00 00 00 00 |.........1......|
00000140 00 00 00 00 00 00 00 00 04 73 74 72 69 6e 67 00 |.........string.|
00000150 18 00 00 00 02 30 00 04 00 00 00 66 6f 6f 00 02 |.....0.....foo..|
00000160 31 00 01 00 00 00 00 00 04 74 69 6d 65 73 74 61 |1........timesta|
00000170 6d 70 00 1b 00 00 00 11 30 00 2a 00 00 00 00 00 |mp......0.*.....|
00000180 00 00 11 31 00 00 00 00 00 00 00 00 00 00 00 |...1...........|
2 changes: 1 addition & 1 deletion internal/types/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ const (

// Binary represents BSON type Binary.
type Binary struct {
Subtype BinarySubtype
B []byte
Subtype BinarySubtype
}
7 changes: 7 additions & 0 deletions tools/checkcomments/checkcomments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ func TestClient(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, issueNotFound, actual)

// The following tests should use cache and not the client,
// but it may be empty if tests above failed for some reason.

if t.Failed() {
return
}

c.c = nil

actual, err = c.IssueStatus(ctx, 10)
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/supported-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ Related [issue](https://github.com/FerretDB/FerretDB/issues/1917).
| | `expireAfterSeconds` | | ⚠️ | [Issue](https://github.com/FerretDB/FerretDB/issues/2415) |
| | `clusteredIndex` | | ⚠️ | |
| | `changeStreamPreAndPostImages` | | ⚠️ | |
| | `autoIndexId` | | ⚠️ | Ignored |
| | `autoIndexId` | | ⚠️ | [Issue](https://github.com/FerretDB/FerretDB/issues/3922) |
| | `size` | | ✅️ | |
| | `max` | || |
| | `storageEngine` | | ⚠️ | Ignored |
Expand Down

0 comments on commit 3eb9ee6

Please sign in to comment.