Skip to content

Commit c5418bb

Browse files
authored
DRIVERS-3030 Ensure mongosh download is properly working (#540)
1 parent c5f92c1 commit c5418bb

File tree

3 files changed

+75
-43
lines changed

3 files changed

+75
-43
lines changed

.evergreen/config.yml

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -512,52 +512,18 @@ functions:
512512
make test
513513
514514
"run mongodl test partial":
515-
- command: shell.exec
515+
- command: subprocess.exec
516516
type: test
517517
params:
518-
shell: bash
519-
script: |-
520-
set -o errexit
521-
cd ${DRIVERS_TOOLS}/.evergreen
522-
. find-python3.sh
523-
PYTHON=$(ensure_python3)
524-
echo "Using PYTHON: $PYTHON"
525-
$PYTHON mongodl.py --edition enterprise --version 7.0 --component archive-debug --no-download
526-
$PYTHON mongodl.py --edition enterprise --version 7.0 --component cryptd --test
527-
$PYTHON mongosh-dl.py --no-download
528-
$PYTHON mongosh-dl.py --version 2.1.1 --no-download
529-
$PYTHON mongosh-dl.py --version 2.1.1 --out $(pwd)
518+
binary: bash
519+
args: [src/.evergreen/tests/test-mongodl.sh, partial]
530520

531521
"run mongodl test full":
532-
- command: shell.exec
522+
- command: subprocess.exec
533523
type: test
534524
params:
535-
shell: bash
536-
script: |-
537-
set -o errexit
538-
cd ${DRIVERS_TOOLS}/.evergreen
539-
. find-python3.sh
540-
PYTHON=$(ensure_python3 2>/dev/null)
541-
echo "Using PYTHON: $PYTHON"
542-
# Ensure that all distros are accounted for in DISTRO_ID_TO_TARGET
543-
export VALIDATE_DISTROS=1
544-
$PYTHON mongodl.py --list
545-
if [ "$OS" != "Windows_NT" ]; then
546-
$PYTHON mongodl.py --edition enterprise --version 7.0.1 --component archive-debug --test
547-
fi
548-
$PYTHON mongodl.py --edition enterprise --version 3.6 --component archive --test
549-
$PYTHON mongodl.py --edition enterprise --version 4.0 --component archive --test
550-
$PYTHON mongodl.py --edition enterprise --version 4.2 --component archive --test
551-
$PYTHON mongodl.py --edition enterprise --version 4.4 --component archive --test
552-
$PYTHON mongodl.py --edition enterprise --version 5.0 --component archive --test
553-
$PYTHON mongodl.py --edition enterprise --version 6.0 --component crypt_shared --test
554-
$PYTHON mongodl.py --edition enterprise --version 8.0 --component archive --test
555-
$PYTHON mongodl.py --edition enterprise --version rapid --component archive --test
556-
$PYTHON mongodl.py --edition enterprise --version latest --component archive --out $(pwd)
557-
$PYTHON mongodl.py --edition enterprise --version v6.0-perf --component cryptd --test
558-
$PYTHON mongodl.py --edition enterprise --version v8.0-perf --component cryptd --test
559-
$PYTHON mongosh-dl.py --no-download
560-
$PYTHON mongosh-dl.py --version 2.1.1 --out $(pwd)
525+
binary: bash
526+
args: [src/.evergreen/tests/test-mongodl.sh]
561527

562528
"teardown assets":
563529
- command: subprocess.exec
@@ -1287,7 +1253,7 @@ axes:
12871253

12881254
- id: amazon-2023-x64
12891255
display_name: "Amazon Linux 2023 x64"
1290-
run_on: amazon2023.0-small
1256+
run_on: amazon2023.3-small
12911257

12921258
- id: macos-14-arm64
12931259
display_name: "macOS 14 arm64"

.evergreen/mongosh-dl.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,21 @@ def _download(out_dir: Path, version: str, target: str,
6565
elif arch == "aarch64":
6666
arch = "arm64"
6767
if target == "linux":
68-
suffix = ".tgz"
68+
suffix = '.tgz'
69+
if sys.platform == 'linux' and arch in ["x64", "arm64"]:
70+
openssl = subprocess.check_output(["openssl", "version"])
71+
if "3.0" in openssl.decode('utf-8'):
72+
suffix = "-openssl3.tgz"
73+
elif "1.1" in openssl.decode('utf-8'):
74+
suffix = "-openssl11.tgz"
6975
else:
7076
suffix = ".zip"
7177
dl_url = f"https://downloads.mongodb.com/compass/mongosh-{version}-{target}-{arch}{suffix}"
78+
print(dl_url)
7279

7380
if no_download:
74-
print(dl_url)
7581
return ExpandResult.Okay
82+
7683
req = urllib.request.Request(dl_url)
7784
resp = urllib.request.urlopen(req)
7885

.evergreen/tests/test-mongodl.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
# Test mongodl and mongosh-dl.
4+
set -eux
5+
6+
SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
7+
. $SCRIPT_DIR/../handle-paths.sh
8+
9+
pushd $SCRIPT_DIR/..
10+
11+
. find-python3.sh
12+
PYTHON=$(ensure_python3)
13+
echo "Using PYTHON: $PYTHON"
14+
DOWNLOAD_DIR=mongodl_test
15+
16+
if [ "${OS:-}" != "Windows_NT" ]; then
17+
$PYTHON mongodl.py --edition enterprise --version 7.0 --component archive-debug --no-download
18+
else
19+
DOWNLOAD_DIR=$(cygpath -m $DOWNLOAD_DIR)
20+
fi
21+
22+
$PYTHON mongodl.py --edition enterprise --version 7.0 --component archive --test
23+
$PYTHON mongodl.py --edition enterprise --version 7.0 --component cryptd --out ${DOWNLOAD_DIR} --strip-path-components 1
24+
$PYTHON mongosh-dl.py --no-download
25+
$PYTHON mongosh-dl.py --version 2.1.1 --no-download
26+
27+
export PATH="${DOWNLOAD_DIR}/bin:$PATH"
28+
if [ "${OS:-}" != "Windows_NT" ]; then
29+
$PYTHON mongosh-dl.py --version 2.1.1 --out ${DOWNLOAD_DIR} --strip-path-components 1
30+
chmod +x ./mongodl_test/bin/mongosh
31+
./mongodl_test/bin/mongosh --version
32+
else
33+
$PYTHON mongosh-dl.py --version 2.1.1 --out ${DOWNLOAD_DIR} --strip-path-components 1
34+
fi
35+
36+
if [ ${1:-} == "partial" ]; then
37+
popd
38+
make -C ${DRIVERS_TOOLS} test
39+
exit 0
40+
fi
41+
42+
# Ensure that all distros are accounted for in DISTRO_ID_TO_TARGET
43+
export VALIDATE_DISTROS=1
44+
$PYTHON mongodl.py --list
45+
$PYTHON mongodl.py --edition enterprise --version 7.0.6 --component archive --no-download
46+
$PYTHON mongodl.py --edition enterprise --version 3.6 --component archive --test
47+
$PYTHON mongodl.py --edition enterprise --version 4.0 --component archive --test
48+
$PYTHON mongodl.py --edition enterprise --version 4.2 --component archive --test
49+
$PYTHON mongodl.py --edition enterprise --version 4.4 --component archive --test
50+
$PYTHON mongodl.py --edition enterprise --version 5.0 --component archive --test
51+
$PYTHON mongodl.py --edition enterprise --version 6.0 --component crypt_shared --test
52+
$PYTHON mongodl.py --edition enterprise --version 8.0 --component archive --test
53+
$PYTHON mongodl.py --edition enterprise --version rapid --component archive --test
54+
$PYTHON mongodl.py --edition enterprise --version latest --component archive --out ${DOWNLOAD_DIR}
55+
$PYTHON mongodl.py --edition enterprise --version v6.0-perf --component cryptd --test
56+
$PYTHON mongodl.py --edition enterprise --version v8.0-perf --component cryptd --test
57+
58+
popd
59+
make -C ${DRIVERS_TOOLS} test

0 commit comments

Comments
 (0)