From f0ba4c1ff97c7ff4a1e57198bdae725a6ecd8434 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sat, 26 Aug 2017 10:37:24 +0300 Subject: [PATCH] test: add simple push/pull/status test for aws Signed-off-by: Ruslan Kuprieiev --- functest/common.sh | 8 ++++++++ functest/run.sh | 1 + functest/test-sync-aws.sh | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100755 functest/test-sync-aws.sh diff --git a/functest/common.sh b/functest/common.sh index 094296428..53f018231 100644 --- a/functest/common.sh +++ b/functest/common.sh @@ -16,6 +16,9 @@ BASE_DIR_S3=https://s3-$REGION.amazonaws.com/dataversioncontrol/functests DATA_S3=$BASE_DIR_S3/stackoverflow_raw_small CODE_S3=$BASE_DIR_S3/code +TEST_REPO_S3='dvc-test/myrepo' +TEST_REPO_REGION='us-east-2' + function dvc_print() { echo -e "$1" } @@ -103,6 +106,11 @@ function dvc_create_repo() { dvc import $DATA_CACHE/* data/xml } +function dvc_clean_cloud_aws() { + dvc_info "Cleaning $TEST_REPO_S3" + aws s3 rm --recursive "s3://$TEST_REPO_S3/" +} + function dvc_check_dirs() { for d in $1; do if [ ! -d "$d" ]; then diff --git a/functest/run.sh b/functest/run.sh index e6d3ef6db..cc36fa836 100755 --- a/functest/run.sh +++ b/functest/run.sh @@ -6,6 +6,7 @@ source common.sh TESTS+=" test-init.sh" TESTS+=" test-import.sh" +TESTS+=" test-sync-aws.sh" TESTS+=" test-repro-code.sh" for t in $TESTS; do diff --git a/functest/test-sync-aws.sh b/functest/test-sync-aws.sh new file mode 100755 index 000000000..1490ee553 --- /dev/null +++ b/functest/test-sync-aws.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -e + +source common.sh + +if [ -z $TRAVIS ]; then + dvc_create_repo + + dvc_info "Setting up AWS cloud" + dvc_clean_cloud_aws + dvc config aws.storagepath $TEST_REPO_S3 + dvc config aws.region $TEST_REPO_REGION + + dvc_info "Checking status" + dvc status data/xml + + dvc_info "Pushing to AWS" + dvc push data/xml + + dvc_info "Checking status" + dvc status data/xml + + dvc_info "Modifying data" + echo "123456" >> data/xml/Tags.xml + + dvc_info "Checking status" + dvc status data/xml + + dvc_info "Pulling data" + dvc pull data/xml + + dvc_info "Checking status" + dvc status data/xml + + dvc_clean_cloud_aws +else + dvc_info "AWS test is disabled for travis" +fi + +dvc_pass