From 811a3c526215f54b61ef426283623e4bfcf34fa8 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 21 Jul 2021 09:03:26 +0200 Subject: [PATCH 1/4] fixing with bigsIntegers --- ...103a9c96b2d_testdatastorage_bigintegers.py | 38 +++++++++++++++++++ ereuse_devicehub/resources/action/models.py | 10 ++--- 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py diff --git a/ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py b/ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py new file mode 100644 index 00000000..87d0626f --- /dev/null +++ b/ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py @@ -0,0 +1,38 @@ +"""TestDataStorage_bigIntegers + +Revision ID: 0103a9c96b2d +Revises: 3a3601ac8224 +Create Date: 2021-07-21 08:56:48.342503 + +""" +from alembic import op, context +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '0103a9c96b2d' +down_revision = '3a3601ac8224' +branch_labels = None +depends_on = None + + +def get_inv(): + INV = context.get_x_argument(as_dictionary=True).get('inventory') + if not INV: + raise ValueError("Inventory value is not specified") + return INV + +def upgrade(): + op.alter_column('test_data_storage', 'reallocated_sector_count', type_=sa.BigInteger(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'power_cycle_count', type_=sa.Integer(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', '_reported_uncorrectable_errors', type_=sa.BigInteger(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'current_pending_sector_count', type_=sa.BigInteger(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'offline_uncorrectable', type_=sa.BigInteger(), schema=f'{get_inv()}') + + +def downgrade(): + op.alter_column('test_data_storage', 'reallocated_sector_count', type_=sa.SmallInteger(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'power_cycle_count', type_=sa.SmallInteger(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', '_reported_uncorrectable_errors', type_=sa.Integer(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'current_pending_sector_count', type_=sa.Integer(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'offline_uncorrectable', type_=sa.Integer(), schema=f'{get_inv()}') diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index d8bcb3ce..29b32c00 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -754,12 +754,12 @@ class TestDataStorage(TestMixin, Test): status = Column(Unicode(), check_lower('status'), nullable=False) lifetime = Column(Interval) assessment = Column(Boolean) - reallocated_sector_count = Column(SmallInteger) - power_cycle_count = Column(SmallInteger) - _reported_uncorrectable_errors = Column('reported_uncorrectable_errors', Integer) + reallocated_sector_count = Column(BigInteger) + power_cycle_count = Column(Integer) + _reported_uncorrectable_errors = Column('reported_uncorrectable_errors', BigInteger) command_timeout = Column(BigInteger) - current_pending_sector_count = Column(Integer) - offline_uncorrectable = Column(Integer) + current_pending_sector_count = Column(BigInteger) + offline_uncorrectable = Column(BigInteger) remaining_lifetime_percentage = Column(SmallInteger) elapsed = Column(Interval, nullable=False) From bf3dbb329adf4f6ce4414abf6d5a43065c3a45ed Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 3 Aug 2021 11:29:56 +0200 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01024d2d..8e179164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ml). ## testing [1.0.8-beta] +- [bugfix] #161 fixing DataStorage with bigInteger ## [1.0.7-beta] - [addend] #158 support for encrypted snapshots data From 6326c0b59d93fe7dbbfad8776b1038a4c240be15 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 3 Aug 2021 11:55:47 +0200 Subject: [PATCH 3/4] fixing reported_uncorrectable_errors --- .../versions/0103a9c96b2d_testdatastorage_bigintegers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py b/ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py index 87d0626f..e4f8d866 100644 --- a/ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py +++ b/ereuse_devicehub/migrations/versions/0103a9c96b2d_testdatastorage_bigintegers.py @@ -25,7 +25,7 @@ def get_inv(): def upgrade(): op.alter_column('test_data_storage', 'reallocated_sector_count', type_=sa.BigInteger(), schema=f'{get_inv()}') op.alter_column('test_data_storage', 'power_cycle_count', type_=sa.Integer(), schema=f'{get_inv()}') - op.alter_column('test_data_storage', '_reported_uncorrectable_errors', type_=sa.BigInteger(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'reported_uncorrectable_errors', type_=sa.BigInteger(), schema=f'{get_inv()}') op.alter_column('test_data_storage', 'current_pending_sector_count', type_=sa.BigInteger(), schema=f'{get_inv()}') op.alter_column('test_data_storage', 'offline_uncorrectable', type_=sa.BigInteger(), schema=f'{get_inv()}') @@ -33,6 +33,6 @@ def upgrade(): def downgrade(): op.alter_column('test_data_storage', 'reallocated_sector_count', type_=sa.SmallInteger(), schema=f'{get_inv()}') op.alter_column('test_data_storage', 'power_cycle_count', type_=sa.SmallInteger(), schema=f'{get_inv()}') - op.alter_column('test_data_storage', '_reported_uncorrectable_errors', type_=sa.Integer(), schema=f'{get_inv()}') + op.alter_column('test_data_storage', 'reported_uncorrectable_errors', type_=sa.Integer(), schema=f'{get_inv()}') op.alter_column('test_data_storage', 'current_pending_sector_count', type_=sa.Integer(), schema=f'{get_inv()}') op.alter_column('test_data_storage', 'offline_uncorrectable', type_=sa.Integer(), schema=f'{get_inv()}') From d123b4e8a8a9d8f8f5cb94348c36da69bee2571a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 3 Aug 2021 13:13:35 +0200 Subject: [PATCH 4/4] up the version --- CHANGELOG.md | 7 +++++-- ereuse_devicehub/__init__.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e179164..ca25c563 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ml). ## master - [1.0.7-beta] + [1.0.8-beta] ## testing - [1.0.8-beta] + [1.0.9-beta] + + +## [1.0.8-beta] - [bugfix] #161 fixing DataStorage with bigInteger ## [1.0.7-beta] diff --git a/ereuse_devicehub/__init__.py b/ereuse_devicehub/__init__.py index 811df9bd..d44f1a11 100644 --- a/ereuse_devicehub/__init__.py +++ b/ereuse_devicehub/__init__.py @@ -1 +1 @@ -__version__ = "1.0.8-beta" +__version__ = "1.0.9-beta"