freezer/tests/scenario/run-local.py
Zahari Zahariev 8e3a5cf8ca Functional tests and Vagrant environment
Proposed environment utilizes Vagrant that works with KVM or
Virtualbox based VM that runs Swift storage node. There are
two major run scripts. Rhe first one run-remote.sh will expect
successfully setup of the Swift VM. Then rsync freezer directory
to the VM and finally execute remotely via SSH run-local.py script
that will create LVM volume and mount it so the functional tests
could be facilitated.

Regular file system (non LVM) and LVM snapshot non incremental
backup tests are included in this commit as the most common usecase.

BLUEPRINT: functional-testing
Change-Id: Ia9c1e2e770ca413fe4a896dd0a55c4babf3df686
2015-03-30 14:35:35 +01:00

54 lines
1.7 KiB
Python
Executable File

#!/usr/bin/python
"""
Copyright 2015 Hewlett-Packard
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com). This product includes software written by Tim
Hudson (tjh@cryptsoft.com).
========================================================================
"""
import os
import sys
import logging
from unittest import TestLoader, TextTestRunner, TestSuite
from backup_scenario import BackupScenarioFS
SWIFT_CONF = 'swiftrc'
def load_swift_env(fname):
file_lines = open(fname, 'r').readlines()
for line in file_lines:
if ' ' not in line.strip():
continue
(cmd, line) = line.split()
if cmd.strip().lower() == 'unset':
os.environ.pop(line, None)
elif '=' in line.strip():
(key, val) = line.split('=')
os.environ[key.strip()] = val.strip()
if __name__ == "__main__":
load_swift_env(SWIFT_CONF)
logging.disable(logging.CRITICAL)
os.system('./vagrant-scripts/create-lvm.sh 1')
loader = TestLoader()
suite = TestSuite(
loader.loadTestsFromTestCase(BackupScenarioFS),
)
runner = TextTestRunner(verbosity = 2)
runner.run(suite)