diff --git a/.travis.yml b/.travis.yml index dd49d7dc2..5081f6878 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,8 @@ before_install: - source ~/.cargo/env script: - - make + - 'if [ "$TRAVIS_REPO_SLUG" != "mozilla/sop" ]; then make; fi' + - 'if [ "$TRAVIS_REPO_SLUG" = "mozilla/sop" ]; then make origin-build; fi' - bash <(curl -s https://codecov.io/bash) before_deploy: diff --git a/Makefile b/Makefile index 553fe256a..99f634354 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ GO := GO15VENDOREXPERIMENT=1 go GOLINT := golint all: test vet generate install functional-tests +origin-build: test vet generate install functional-tests-all install: $(GO) install go.mozilla.org/sops/cmd/sops @@ -40,6 +41,12 @@ functional-tests: $(GO) build -o functional-tests/sops go.mozilla.org/sops/cmd/sops cd functional-tests && cargo test +# Ignored tests are ones that require external services (e.g. AWS KMS) +# TODO: Once `--include-ignored` lands in rust stable, switch to that. +functional-tests-all: + $(GO) build -o functional-tests/sops go.mozilla.org/sops/cmd/sops + cd functional-tests && cargo test && cargo test -- --ignored + deb-pkg: install rm -rf tmppkg mkdir -p tmppkg/usr/local/bin diff --git a/functional-tests/src/lib.rs b/functional-tests/src/lib.rs index 49e4f8411..01ec5379e 100644 --- a/functional-tests/src/lib.rs +++ b/functional-tests/src/lib.rs @@ -75,14 +75,9 @@ mod tests { } #[test] + #[ignore] fn encrypt_json_file_kms() { - let kms_arn = match env::var(KMS_KEY) { - Ok(val) => val, - _ => "".to_string(), - }; - if kms_arn == "" { - return; - } + let kms_arn = env::var(KMS_KEY).expect("Expected $FUNCTIONAL_TEST_KMS_ARN env var to be set"); let file_path = prepare_temp_file("test_encrypt_kms.json", b"{ @@ -450,14 +445,9 @@ b: ba"# } #[test] + #[ignore] fn roundtrip_kms_encryption_context() { - let kms_arn = match env::var(KMS_KEY) { - Ok(val) => val, - _ => "".to_string(), - }; - if kms_arn == "" { - return; - } + let kms_arn = env::var(KMS_KEY).expect("Expected $FUNCTIONAL_TEST_KMS_ARN env var to be set"); let file_path = prepare_temp_file("test_roundtrip_kms_encryption_context.json", b"{