Skip to content

Commit

Permalink
test: enable gcp tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ruslan Kuprieiev <[email protected]>
  • Loading branch information
efiop committed Feb 15, 2018
1 parent 5b588d9 commit a58f3b8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ branches:
platform: x86

environment:
my_variable:
aws_access_key_id:
secure: veTfhOrd4wUpG7NlRsvS3tufuaFfST8i7SZa2HVH6Vc=
aws_secret_access_key:
secure: nCQcN/Mzce0erwcNOU3yAuWgF6ZuTvPBEqTF3XFp1poGcDbSIg+s67eVxsxWCXQj
GOOGLE_APPLICATION_CREDENTIALS: gcp-creds.json
GCP_CREDS:
secure: 96fJ3r2i2GohbXHwnSs5N4EplQ7q8YmLpPWM0AC+f4s=

matrix:

Expand Down Expand Up @@ -42,6 +44,8 @@ install:
- cinst graphviz
- cinst wget
- cinst awscli
- cinst gsutil
- cinst openssl.light
- wget --no-check-certificate https://github.com/dpinney/omf/raw/master/omf/static/pygraphviz-1.3.1-cp27-none-win32.whl
- pip install pygraphviz-1.3.1-cp27-none-win32.whl
- pip install -r requirements.txt
Expand All @@ -52,6 +56,7 @@ build: false
before_test:
- aws configure set aws_access_key_id "%aws_access_key_id%"
- aws configure set aws_secret_access_key "%aws_secret_access_key%"
- openssl enc -d -aes-256-cbc -md md5 -k "%GCP_CREDS%" -in scripts\ci\gcp-creds.json.enc -out scripts\ci\gcp-creds.json & exit 0
- pip install -r test-requirements.txt

test_script:
Expand Down
Binary file added scripts/ci/gcp-creds.json.enc
Binary file not shown.
1 change: 1 addition & 0 deletions scripts/ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ printf "[default]\n" > ~/.aws/credentials
printf "aws_access_key_id = $AWS_ACCESS_KEY_ID\n" >> ~/.aws/credentials
printf "aws_secret_access_key = $AWS_SECRET_ACCESS_KEY\n" >> ~/.aws/credentials
printf "[default]\n" > ~/.aws/config
openssl enc -d -aes-256-cbc -md md5 -k $GCP_CREDS -in scripts/ci/gcp-creds.json.enc -out scripts/ci/gcp-creds.json || true
1 change: 1 addition & 0 deletions tests/basic_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


class TestDir(TestCase):
GCP_CREDS_FILE = os.path.abspath(os.path.join('scripts', 'ci', 'gcp-creds.json'))
DATA_DIR = 'data_dir'
DATA_SUB_DIR = os.path.join(DATA_DIR, 'data_sub_dir')
DATA = os.path.join(DATA_DIR, 'data')
Expand Down
13 changes: 9 additions & 4 deletions tests/test_data_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,29 @@ def test(self):


class TestDataCloudGCP(TestDataCloudBase):
TEST_REPO_GCP = 'dvc-test/myrepo'
TEST_REPO_GCP_BUCKET = 'dvc-test'
TEST_REPO_GCP_PROJECT='dvc-project'

def _should_test(self):
if os.getenv("DVC_TEST_GCP") == "true":
return True

if os.getenv("GOOGLE_APPLICATION_CREDENTIALS") and os.getenv("GCP_CREDS"):
return True

return False

def _setup_cloud(self):
if not self._should_test():
return

# Cleanup
os.system("gsutil rm -rf gs://{}/".format(self.TEST_REPO_GCP))
if os.getenv("GOOGLE_APPLICATION_CREDENTIALS") and os.getenv("GCP_CREDS"):
shutil.copyfile(self.GCP_CREDS_FILE, os.getenv("GOOGLE_APPLICATION_CREDENTIALS"))

repo = self.TEST_REPO_GCP_BUCKET + '/' + str(uuid.uuid4())

# Setup cloud
config = {'StoragePath': self.TEST_REPO_GCP,
config = {'StoragePath': repo,
'Region': self.TEST_REPO_GCP_PROJECT}
cloud_settings = CloudSettings(self.dvc.cache.cache_dir, None, config)
self.cloud = DataCloudGCP(cloud_settings)
Expand Down

0 comments on commit a58f3b8

Please sign in to comment.