Skip to content
Closed
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
23 changes: 21 additions & 2 deletions .evergreen/scripts/create-spec-pr.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -eu

tools="$(realpath -s "../drivers-tools")"
pushd $tools/.evergreen/github_app || exit
Expand Down Expand Up @@ -37,14 +38,32 @@ git commit -am "resyncing specs $(date '+%m-%d-%Y')"
echo "Creating the git checkout... done."

git push origin $branch

# Build the payload as a file so the body content is always properly
# JSON-escaped, rather than interpolated into the command line as text.
payload_file=$(mktemp)
trap 'rm -f "$payload_file"' EXIT
jq -n \
--arg title "[Spec Resync] $(date '+%m-%d-%Y')" \
--arg head "${branch}" \
--rawfile body "$1" \
'{title: $title, body: $body, head: $head, base: "main"}' > "$payload_file"

resp=$(curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $token" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d "{\"title\":\"[Spec Resync] $(date '+%m-%d-%Y')\",\"body\":\"$(cat "$1")\",\"head\":\"${branch}\",\"base\":\"main\"}" \
-d "@${payload_file}" \
--url https://api.github.com/repos/$owner/$repo/pulls)
echo $resp | jq '.html_url'

pr_url=$(echo "$resp" | jq -r '.html_url // empty')
if [ -z "$pr_url" ]; then
echo "Failed to create PR! API response:"
echo "$resp" | jq .
exit 1
fi
echo "$pr_url"
echo "Creating the PR... done."

rm -rf $tools
15 changes: 15 additions & 0 deletions test/bson_corpus/dbref.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@
"canonical_bson": "4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000",
"canonical_extjson": "{\"dbref\": {\"$ref\": \"collection\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}, \"foo\": \"bar\"}}"
},
{
"description": "DBRef with dotted collection name",
"canonical_bson": "3a000000036462726566002e0000000224726566000e00000064622e636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000",
"canonical_extjson": "{\"dbref\": {\"$ref\": \"db.collection\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}}}"
},
{
"description": "DBRef with dotted collection name and database",
"canonical_bson": "4b000000036462726566003f0000000224726566000e00000064622e636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200080000006f746865726462000000",
"canonical_extjson": "{\"dbref\": {\"$ref\": \"db.collection\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}, \"$db\": \"otherdb\"}}"
},
{
"description": "DBRef with multiple dots in collection name",
"canonical_bson": "32000000036462726566002600000002247265660006000000612e622e6300072469640058921b3e6e32ab156a22b59e0000",
"canonical_extjson": "{\"dbref\": {\"$ref\": \"a.b.c\", \"$id\": {\"$oid\": \"58921b3e6e32ab156a22b59e\"}}}"
},
{
"description": "Document with key names similar to those of a DBRef",
"canonical_bson": "3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000",
Expand Down
88 changes: 88 additions & 0 deletions test/unified-test-format/valid-pass/operator-gte.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"description": "operator-gte",
"schemaVersion": "1.29",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "database0Name"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"collectionName": "coll0",
"databaseName": "database0Name",
"documents": []
}
],
"tests": [
{
"description": "special gte matching operator",
"operations": [
{
"name": "insertOne",
"object": "collection0",
"arguments": {
"document": {
"_id": 1,
"x": 2,
"y": 3,
"z": 4
}
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"insert": "coll0",
"documents": [
{
"_id": {
"$$gte": 1
},
"x": {
"$$gte": 1.9
},
"y": {
"$$gte": {
"$numberLong": "3"
}
},
"z": {
"$$gte": 4
}
}
]
},
"commandName": "insert",
"databaseName": "database0Name"
}
}
]
}
]
}
]
}
Loading