1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Only run kms functional tests within mozilla/sops

Instead of exiting early, only run the kms tests within the context of
mozilla/sops (and not from forks).
This commit is contained in:
AJ Bahnken
2019-03-29 10:42:01 -07:00
parent 23fb078e05
commit f000986f20
3 changed files with 13 additions and 15 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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"{