diff --git a/.travis.yml b/.travis.yml index cb37fcf..cb27a78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,5 @@ os: - osx script: - - cargo build --verbose --all - - cargo test --verbose --all + - cargo build --all --all-targets + - cargo test --all diff --git a/README.md b/README.md index 1b78897..27d21c1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # s3mon [![crates.io](https://img.shields.io/crates/v/s3mon.svg)](https://crates.io/crates/s3mon) -[![CircleCI](https://circleci.com/gh/s3mon/s3mon/tree/master.svg?style=svg)](https://circleci.com/gh/s3mon/s3mon/tree/master) +[![Build Status](https://travis-ci.org/s3mon/s3mon.svg?branch=master)](https://travis-ci.org/s3mon/s3mon) monitor s3 bucket for missing files diff --git a/src/main.rs b/src/main.rs index e109f3c..c1d3504 100644 --- a/src/main.rs +++ b/src/main.rs @@ -313,4 +313,35 @@ s3mon: "cubeta,prefix=E error=false exist=false size_mismatch=false", ); } + + #[test] + fn check_object_no_bucket() { + use chrono::prelude::{SecondsFormat, Utc}; + use rusoto_core::Region; + use rusoto_mock::{MockCredentialsProvider, MockRequestDispatcher}; + use rusoto_s3::S3Client; + + let mock = MockRequestDispatcher::with_status(404).with_body( + r#" + + NoSuchBucket + The specified bucket does not exist + 4442587FB7D0A2F9 + "#, + ); + let client = Arc::new(s3::S3monS3 { + s3: S3Client::new_with(mock, MockCredentialsProvider, Region::UsEast1), + }); + // test finding file & prefix + let file = config::Object { + prefix: "E".to_string(), + age: 30, + size: 512, + }; + + assert_eq!( + check(client.clone(), "cubeta".to_string(), file), + "cubeta,prefix=E error=true exist=false size_mismatch=false", + ); + } }