Merge pull request #143 from eReuse/bugfix/#141-testdatastorage

Bugfix/#141 testdatastorage
This commit is contained in:
cayop 2021-05-12 13:14:48 +02:00 committed by GitHub
commit 420d572bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,30 @@
"""change command_timeout of TestDataStorage Action
Revision ID: 398826453b39
Revises: 8d34480c82c4
Create Date: 2021-05-12 12:41:02.808311
"""
from alembic import op, context
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '398826453b39'
down_revision = '8d34480c82c4'
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', 'command_timeout', type_=sa.BigInteger(), schema=f'{get_inv()}')
def downgrade():
op.alter_column('test_data_storage', 'command_timeout', type_=sa.Integer(), schema=f'{get_inv()}')

View File

@ -10,7 +10,7 @@ from alembic import context
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy.dialects import postgresql from sqlalchemy.dialects import postgresql
from ereuse_devicehub.resources.device.search import DeviceSearch # from ereuse_devicehub.resources.device.search import DeviceSearch
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.

View File

@ -742,7 +742,7 @@ class TestDataStorage(TestMixin, Test):
reallocated_sector_count = Column(SmallInteger) reallocated_sector_count = Column(SmallInteger)
power_cycle_count = Column(SmallInteger) power_cycle_count = Column(SmallInteger)
_reported_uncorrectable_errors = Column('reported_uncorrectable_errors', Integer) _reported_uncorrectable_errors = Column('reported_uncorrectable_errors', Integer)
command_timeout = Column(Integer) command_timeout = Column(BigInteger)
current_pending_sector_count = Column(Integer) current_pending_sector_count = Column(Integer)
offline_uncorrectable = Column(Integer) offline_uncorrectable = Column(Integer)
remaining_lifetime_percentage = Column(SmallInteger) remaining_lifetime_percentage = Column(SmallInteger)

File diff suppressed because one or more lines are too long

View File

@ -838,3 +838,12 @@ def test_snapshot_mobil(app: Devicehub, user: UserClient):
tmp_snapshots = app.config['TMP_SNAPSHOTS'] tmp_snapshots = app.config['TMP_SNAPSHOTS']
shutil.rmtree(tmp_snapshots) shutil.rmtree(tmp_snapshots)
@pytest.mark.mvp
def test_bug_141(user: UserClient):
"""This test check one bug that create a problem when try to up one snapshot
with a big number in the parameter command_timeout of the DataStorage
"""
user.post(file('2021-5-4-13-41_time_out_test_datastorage'), res=Snapshot)