Skip to content
Merged
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
36 changes: 32 additions & 4 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,23 @@ functions:

export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
export UPLOAD_BUCKET="${project}"
export PROJECT_DIRECTORY="$(pwd)"

cat <<EOT > expansion.yml
CURRENT_VERSION: "$CURRENT_VERSION"
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME"
MONGODB_BINARIES: "$MONGODB_BINARIES"
UPLOAD_BUCKET: "$UPLOAD_BUCKET"
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
PREPARE_SHELL: |
set -o errexit
set -o xtrace
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
export MONGODB_BINARIES="$MONGODB_BINARIES"
export UPLOAD_BUCKET="$UPLOAD_BUCKET"
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
export DRIVERS_TOOLS_X509="$DRIVERS_TOOLS/.evergreen/x509gen"

Expand Down Expand Up @@ -163,13 +166,29 @@ functions:
${PREPARE_SHELL}
.evergreen/check-clippy.sh

"cleanup":
"upload-mo-artifacts":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
rm -rf ~/.rustup

find $MONGO_ORCHESTRATION_HOME -name \*.log | xargs tar czf mongodb-logs.tar.gz
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongodb-logs.tar.gz
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "mongodb-logs.tar.gz"

"stop mongo orchestration":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}

cd "$MONGO_ORCHESTRATION_HOME"
# source the mongo-orchestration virtualenv if it exists
if [ -f venv/bin/activate ]; then
Expand All @@ -178,7 +197,14 @@ functions:
. venv/Scripts/activate
fi
mongo-orchestration stop
cd -


"cleanup":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
rm -rf ~/.rustup
rm -rf $DRIVERS_TOOLS || true

"fix absolute paths":
Expand Down Expand Up @@ -226,6 +252,8 @@ pre:
- func: "install dependencies"

post:
- func: "stop mongo orchestration"
- func: "upload-mo-artifacts"
- func: "cleanup"

tasks:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bson = "1.0.0"
chrono = "0.4.7"
derivative = "2.1.1"
err-derive = "0.2.3"
futures = "0.3.4"
futures = "0.3.5"
futures-intrusive = "0.3.0"
hex = "0.4.0"
hmac = "0.7.1"
Expand All @@ -49,7 +49,7 @@ webpki = "0.21.0"
webpki-roots = "0.18.0"

[dependencies.async-std]
version = "~1.5.0"
version = "1.6.2"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

optional = true

[dependencies.pbkdf2]
Expand Down
9 changes: 9 additions & 0 deletions src/client/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,15 @@ impl ClientOptions {
Ok(options)
}

#[cfg(test)]
pub(crate) fn parse_without_srv_resolution(s: &str) -> Result<Self> {
let parser = ClientOptionsParser::parse(s)?;
let options: Self = parser.into();
options.validate()?;

Ok(options)
}

/// Gets the original SRV hostname specified when this ClientOptions was parsed from a URI.
pub(crate) fn original_srv_hostname(&self) -> Option<&String> {
self.original_srv_hostname.as_ref()
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl AsyncRuntime {
/// Run a future in the foreground, blocking on it completing.
///
/// This will panic if called from a sychronous context when tokio is being used.
#[cfg_attr(not(feature = "sync"), cfg(test))]
#[cfg(feature = "sync")]
pub(crate) fn block_on<F, T>(self, fut: F) -> T
where
F: Future<Output = T> + Send,
Expand Down
4 changes: 2 additions & 2 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ pub(crate) use self::{
use lazy_static::lazy_static;

use self::util::TestLock;
use crate::{options::ClientOptions, RUNTIME};
use crate::options::ClientOptions;

const MAX_POOL_SIZE: u32 = 100;

lazy_static! {
pub(crate) static ref CLIENT_OPTIONS: ClientOptions = {
let uri = std::env::var("MONGODB_URI")
.unwrap_or_else(|_| "mongodb://localhost:27017".to_string());
let mut options = RUNTIME.block_on(ClientOptions::parse(&uri)).unwrap();
let mut options = ClientOptions::parse_without_srv_resolution(&uri).unwrap();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!

options.max_pool_size = Some(MAX_POOL_SIZE);

options
Expand Down