Skip to content

Commit

Permalink
Release 0.4.7
Browse files Browse the repository at this point in the history
Bugfix:
* [GH-92] Add unittests in pypi package.
* [GH-90] Unity: Check version for attaching snap.
  • Loading branch information
Cedric Zhuang committed Feb 14, 2017
2 parents ba43453 + 4ef61cc commit f577ad6
Show file tree
Hide file tree
Showing 945 changed files with 158 additions and 123 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ install:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
script:
- flake8 storops test comptest
- "py.test -n2 --cov=storops --cov-config coverage.ini --cov-report=xml --cov-report term --junit-xml=junit-result.xml test"
- flake8 storops storops_test storops_comptest
- "py.test -n2 --cov=storops --cov-config coverage.ini --cov-report=xml --cov-report term --junit-xml=junit-result.xml storops_test"
after_success:
- coveralls
notifications:
Expand Down
5 changes: 4 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
include *.md
include *.cfg
include *.rst
include *.txt
recursive-include . *.txt
recursive-include storops_test *.json
recursive-include storops_test *.xml
recursive-include storops_test *.html
recursive-include storops *.yaml
25 changes: 24 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ StorOps: The Python Library for VNX & Unity
.. image:: https://landscape.io/github/emc-openstack/storops/master/landscape.svg?style=flat
:target: https://landscape.io/github/emc-openstack/storops/

VERSION: 0.4.6
VERSION: 0.4.7

A minimalist Python library to manage VNX/Unity systems.
This document lies in the source code and go with the release.
Expand Down Expand Up @@ -356,6 +356,29 @@ Getting Help
vnx.get_pool vnx.json vnx.with_poll
vnx.get_pool_feature vnx.parse
How to Run Unittests
--------------------
Unittests are included in the `storops_test` package.
Use following command to install test dependencies.
.. code-block:: bash
$ pip install -r test-requirements.txt
Use `pytest` to run the tests.
.. code-block:: bash
$ pytest storops_test
Or you could use `tox` to run the tests.
.. code-block:: bash
$ tox -e py36
How to Contribute
-----------------
Expand Down
3 changes: 2 additions & 1 deletion coverage.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[run]
branch = True
parallel = True
source = storops

[report]

ignore_errors = True

[xml]
output = coverage.xml
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import os
import re

from setuptools import setup, find_packages
from setuptools import setup

__author__ = 'Cedric Zhuang'

Expand Down Expand Up @@ -72,7 +72,7 @@ def get_long_description():
license='Apache Software License',
keywords='VNX Unity EMC Storage',
include_package_data=True,
packages=find_packages(),
packages=['storops', 'storops_test', 'storops_comptest'],
platforms=['any'],
long_description=get_long_description(),
classifiers=[
Expand Down
1 change: 1 addition & 0 deletions storops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ def disable_log():
logger.info('disabling logging to console.')
logger.setLevel(logging.NOTSET)
logger.handlers = []
return logger
3 changes: 3 additions & 0 deletions storops/unity/resource/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ def attach(self, lun_or_snap, skip_hlu_0=False):
lun_or_snap.attach_to(self)
self.update()
hlu = self.get_hlu(lun_or_snap)
except ex.SystemAPINotSupported:
# Attaching snap to host not support before 4.1.
raise
except ex.UnityAttachExceedLimitError:
# The number of luns exceeds system limit
raise
Expand Down
2 changes: 2 additions & 0 deletions storops/unity/resource/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import logging

from storops.lib.common import instance_cache
from storops.lib.version import version
from storops.unity import enums
from storops.unity.enums import FilesystemSnapAccessTypeEnum, SnapStateEnum, \
SnapAccessLevelEnum
Expand Down Expand Up @@ -104,6 +105,7 @@ def existed(self):
return (super(UnitySnap, self).existed and
self.state != SnapStateEnum.DESTROYING)

@version('>=4.1')
def attach_to(self, host, access_mask=SnapAccessLevelEnum.READ_WRITE):
host_access = [{'host': host, 'allowedAccess': access_mask}]
# If this lun has been attached to other host, don't overwrite it.
Expand Down
2 changes: 1 addition & 1 deletion comptest/__init__.py → storops_comptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import logging

from comptest.utils import inter_process_locked
from storops_comptest.utils import inter_process_locked
from storops import VNXSystem, UnitySystem, cache

__author__ = 'Cedric Zhuang'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

from retryz import retry

from comptest import t_unity
from comptest.utils import ResourceManager
from storops_comptest import t_unity
from storops_comptest.utils import ResourceManager
from storops import exception as ex, FSSupportedProtocolEnum, \
FileInterfaceRoleEnum
from storops.exception import UnityCifsServiceNotEnabledError, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import pytest

from comptest.unity import UnityGeneralFixture, UnityCifsShareFixture
from comptest.utils import is_jenkins, setup_fixture
from storops_comptest.unity import UnityGeneralFixture, UnityCifsShareFixture
from storops_comptest.utils import is_jenkins, setup_fixture

__author__ = 'Cedric Zhuang'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import pytest
from hamcrest import assert_that, equal_to, has_items, has_item, none

from comptest.utils import is_jenkins
from storops_comptest.utils import is_jenkins
from storops import HostTypeEnum, ACEAccessLevelEnum

__author__ = 'Cedric Zhuang'
Expand Down
2 changes: 1 addition & 1 deletion comptest/utils.py → storops_comptest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from storops.exception import StoropsException
from storops.lib.common import get_lock_file
from test.utils import PersistedDict
from storops_test.utils import PersistedDict

__author__ = 'Cedric Zhuang'

Expand Down
4 changes: 2 additions & 2 deletions comptest/vnx/__init__.py → storops_comptest/vnx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

from retryz import retry

from comptest import t_vnx, vnx1, vnx2
from comptest.utils import ResourceManager
from storops_comptest import t_vnx, vnx1, vnx2
from storops_comptest.utils import ResourceManager
from storops import exception as ex

__author__ = 'Cedric Zhuang'
Expand Down
4 changes: 2 additions & 2 deletions comptest/vnx/conftest.py → storops_comptest/vnx/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import pytest

from comptest.utils import setup_fixture
from comptest.vnx import VNXGeneralFixtureManager, \
from storops_comptest.utils import setup_fixture
from storops_comptest.vnx import VNXGeneralFixtureManager, \
MultiVNXGeneralFixtureManager

__author__ = 'Cedric Zhuang'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from __future__ import unicode_literals

import pytest
from comptest import t_vnx
from storops_comptest import t_vnx
from hamcrest import assert_that, equal_to

__author__ = 'Cedric Zhuang'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from hamcrest import assert_that, equal_to, raises
from retryz import retry

from comptest import t_vnx
from storops_comptest import t_vnx
from storops.exception import VNXLunExtendError, VNXDedupAlreadyEnabled, \
VNXLunPreparingError, VNXNotReadyExpandError
from storops.vnx.enums import VNXProvisionEnum, VNXTieringEnum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from storops.exception import VNXMirrorSyncImageError, \
VNXMirrorPromotePrimaryError

from comptest import vnx1, vnx2
from storops_comptest import vnx1, vnx2

__author__ = 'Cedric Zhuang'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from __future__ import unicode_literals

import pytest
from comptest import t_vnx
from storops_comptest import t_vnx
from hamcrest import assert_that, equal_to, only_contains, none

__author__ = 'Cedric Zhuang'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from hamcrest import assert_that, not_none, greater_than, equal_to

from comptest import t_vnx
from storops_comptest import t_vnx

__author__ = 'Cedric Zhuang'

Expand Down
6 changes: 2 additions & 4 deletions test/__init__.py → storops_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class StoropsTest(unittest.TestCase):
def test_vnx_availability(self):
vnx = storops.VNXSystem('10.244.211.30')
vnx = storops.VNXSystem('10.244.211.30', heartbeat_interval=0)
assert_that(vnx, not_none())

def test_unity_availability(self):
Expand Down Expand Up @@ -63,7 +63,5 @@ def test_enable_log_called_twice(self):

def test_disable_log(self):
storops.enable_log()
storops.disable_log()
log = logging.getLogger('storops')
log = storops.disable_log()
assert_that(len(log.handlers), equal_to(0))
assert_that(log.getEffectiveLevel(), equal_to(logging.NOTSET))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/lib/test_resource.py → storops_test/lib/test_resource.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from storops.unity.resource.lun import UnityLun
from storops.unity.resource.sp import UnityStorageProcessor, \
UnityStorageProcessorList
from test.unity.rest_mock import t_unity, patch_rest
from storops_test.unity.rest_mock import t_unity, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
2 changes: 1 addition & 1 deletion test/lib/test_tasks.py → storops_test/lib/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from persistqueue import Empty

from storops.lib import tasks
from test.vnx.cli_mock import patch_cli, t_vnx
from storops_test.vnx.cli_mock import patch_cli, t_vnx
import time


Expand Down
4 changes: 2 additions & 2 deletions test/lib/test_version.py → storops_test/lib/test_version.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from storops.exception import SystemAPINotSupported
from storops.lib.resource import Resource
from storops.lib.version import version, Criteria
from test.unity.rest_mock import t_rest, patch_rest
from test.vnx.cli_mock import patch_cli, t_cli
from storops_test.unity.rest_mock import t_rest, patch_rest
from storops_test.vnx.cli_mock import patch_cli, t_cli


class ParentResource(Resource):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions test/test_utils.py → storops_test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

from hamcrest import assert_that, equal_to, only_contains

from comptest.utils import ResourceManager
from test.utils import PersistedDict
from storops_comptest.utils import ResourceManager
from storops_test.utils import PersistedDict

__author__ = 'Cedric Zhuang'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from storops.unity.resource.health import UnityHealth
from storops.unity.resource.interface import UnityFileInterfaceList
from storops.unity.resource.nas_server import UnityNasServer
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from storops.unity.resource.cifs_share import UnityCifsShare, \
UnityCifsShareList, UnityAclUser, UnityAclUserList
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from storops import DiskTechnologyEnum, TierTypeEnum
from storops.unity.resource.disk import UnityDiskList, UnityDisk
from test.unity.rest_mock import t_rest, patch_rest, t_unity
from storops_test.unity.rest_mock import t_rest, patch_rest, t_unity

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from storops.unity.resource.dns_server import UnityFileDnsServerList, \
UnityFileDnsServer
from storops.unity.resource.nas_server import UnityNasServer
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from storops.unity.resource.pool import UnityPool
from storops.unity.resource.storage_resource import UnityStorageResource
from storops.unity.resource.health import UnityHealth
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from storops.unity.resource.snap import UnitySnap
from storops.unity.resource.tenant import UnityTenant
from storops.unity.resource.vmware import UnityDataStoreList, UnityVmList
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
UnityPreferredInterfaceSettingsList
from storops.unity.resource.nas_server import UnityNasServer
from storops.unity.resource.port import UnityIpPort
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from storops.unity.resource.nas_server import UnityNasServer
from storops import exception as ex

from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
from storops.unity.resource.snap import UnitySnap
from storops.unity.resource.sp import UnityStorageProcessor
from storops.unity.resource.storage_resource import UnityStorageResource
from test.unity.rest_mock import t_rest, patch_rest, t_unity
from test.utils import is_nan
from storops_test.unity.rest_mock import t_rest, patch_rest, t_unity
from storops_test.utils import is_nan

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from storops.unity.calculator import IdValues
from storops.unity.resource.metric import UnityMetric, UnityMetricList, \
UnityMetricRealTimeQuery, UnityMetricRealTimeQueryList
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from storops.unity.resource.pool import UnityPool
from storops.unity.resource.sp import UnityStorageProcessor
from storops.unity.resource.system import UnityVirusChecker
from test.unity.rest_mock import t_rest, patch_rest
from storops_test.unity.rest_mock import t_rest, patch_rest

__author__ = 'Cedric Zhuang'

Expand Down
Loading

0 comments on commit f577ad6

Please sign in to comment.