diff --git a/Makefile b/Makefile index 5c9c83be6a..1465587253 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ UNAME_S := $(shell uname -s) HAS_DOCKER := $(shell command -v docker 2> /dev/null) +TESTING_FS_ROOT := $(shell mktemp -d /tmp/testing-fs-root-XXXXXX) ifneq (${IN_DOCKER},) IN_DOCKER := ${IN_DOCKER} else ifeq ($(UNAME_S),Darwin) @@ -186,7 +187,7 @@ $(foreach component,$(ALL),$(eval $(call BUILD,$(component)))) define UNIT unit-$1: image ## executes the $1 component's unit test suite - $(run) sh -c 'cd components/$1 && cargo test $(CARGO_FLAGS)' + $(run) sh -c 'cd components/$1 && TESTING_FS_ROOT=$(TESTING_FS_ROOT) cargo test $(CARGO_FLAGS)' .PHONY: unit-$1 endef $(foreach component,$(ALL),$(eval $(call UNIT,$(component)))) diff --git a/components/common/src/templating/mod.rs b/components/common/src/templating/mod.rs index f5418e4c08..eeefb85b45 100644 --- a/components/common/src/templating/mod.rs +++ b/components/common/src/templating/mod.rs @@ -118,6 +118,10 @@ fn never_escape(data: &str) -> String { #[cfg(test)] mod test { + use super::*; + use crate::hcore::fs::{pkg_root_path, FS_ROOT_PATH}; + use crate::hcore::package::PackageIdent; + use crate::templating::test_helpers::*; use serde_json; use std::collections::BTreeMap; use std::env; @@ -127,12 +131,6 @@ mod test { use tempfile::TempDir; use toml; - use crate::hcore::fs::FS_ROOT_PATH; - use crate::hcore::package::PackageIdent; - - use super::*; - use crate::templating::test_helpers::*; - pub fn root() -> PathBuf { PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests") } @@ -309,7 +307,7 @@ test: something"# let rendered = renderer.render("t", &data).unwrap(); assert_eq!( PathBuf::from(rendered), - (&*FS_ROOT_PATH).join("/hab/pkgs/core/acl/2.2.52/20161208223311",) + pkg_root_path(Some(&*FS_ROOT_PATH)).join("core/acl/2.2.52/20161208223311",) ); } diff --git a/components/pkg-export-kubernetes/src/lib.rs b/components/pkg-export-kubernetes/src/lib.rs index 2fe6752c70..f5b18d7b2a 100644 --- a/components/pkg-export-kubernetes/src/lib.rs +++ b/components/pkg-export-kubernetes/src/lib.rs @@ -12,12 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use base64; use clap; use habitat_common as common; use habitat_core as hcore; use habitat_pkg_export_docker as export_docker; -use handlebars; #[macro_use] extern crate serde_json; diff --git a/components/sup-protocol/src/lib.rs b/components/sup-protocol/src/lib.rs index abff0f2d05..2d38bacb21 100644 --- a/components/sup-protocol/src/lib.rs +++ b/components/sup-protocol/src/lib.rs @@ -45,7 +45,6 @@ use habitat_core as core; extern crate lazy_static; #[macro_use] extern crate log; -use prost; #[macro_use] extern crate prost_derive; diff --git a/components/sup/tests/integration.rs b/components/sup/tests/integration.rs index dff9dc1c9f..2225fb52a3 100644 --- a/components/sup/tests/integration.rs +++ b/components/sup/tests/integration.rs @@ -20,7 +20,6 @@ extern crate habitat_core as hcore; #[macro_use] extern crate lazy_static; -use rand; mod utils; diff --git a/support/ci/rust_tests.sh b/support/ci/rust_tests.sh index 34d9156b0e..0947cb24f6 100755 --- a/support/ci/rust_tests.sh +++ b/support/ci/rust_tests.sh @@ -1,8 +1,5 @@ #!/bin/bash -sudo mkdir -p /hab -sudo chmod o+w /hab - git log HEAD~1..HEAD | grep -q '!!! Temporary Commit !!!' is_tmp_commit=$? diff --git a/ubuntu@54.188.146.158 b/ubuntu@54.188.146.158 deleted file mode 100644 index 7bb3ea37fd..0000000000 Binary files a/ubuntu@54.188.146.158 and /dev/null differ