Add Install.address; fix asus test

This commit is contained in:
Xavier Bustamante Talavera 2018-11-26 13:11:07 +01:00
parent 0296b8c62a
commit 33f6ee540b
5 changed files with 203 additions and 5 deletions

View File

@ -29,7 +29,8 @@ class Dummy:
('A0000000000001', 'DT-AAAAA'), ('A0000000000001', 'DT-AAAAA'),
('A0000000000002', 'DT-BBBBB'), ('A0000000000002', 'DT-BBBBB'),
('A0000000000003', 'DT-CCCCC'), ('A0000000000003', 'DT-CCCCC'),
('04970DA2A15984', 'DT-BRRAB') ('04970DA2A15984', 'DT-BRRAB'),
('04e4bc5af95980', 'DT-XXXXX')
) )
"""eTags to create.""" """eTags to create."""
ORG = 'eReuse.org CAT', '-t', 'G-60437761', '-c', 'ES' ORG = 'eReuse.org CAT', '-t', 'G-60437761', '-c', 'ES'
@ -84,7 +85,8 @@ class Dummy:
if s.get('uuid', None) == 'de4f495e-c58b-40e1-a33e-46ab5e84767e': # oreo if s.get('uuid', None) == 'de4f495e-c58b-40e1-a33e-46ab5e84767e': # oreo
# Make one hdd ErasePhysical # Make one hdd ErasePhysical
hdd = next(hdd for hdd in s['components'] if hdd['type'] == 'HardDrive') hdd = next(hdd for hdd in s['components'] if hdd['type'] == 'HardDrive')
user.post({'type': 'ErasePhysical', 'method': 'Shred', 'device': hdd['id']}, res=m.Event) user.post({'type': 'ErasePhysical', 'method': 'Shred', 'device': hdd['id']},
res=m.Event)
assert sample_pc assert sample_pc
print('PC sample is', sample_pc) print('PC sample is', sample_pc)
# Link tags and eTags # Link tags and eTags

View File

@ -0,0 +1,190 @@
# This is a complete Snapshot with benchmarks, tests, erasure
# installation, and an eTag (TIS) linked
{
"closed": true,
"components": [
{
"address": 64,
"cores": 1,
"events": [
{
"elapsed": 0,
"rate": 6666.22,
"type": "BenchmarkProcessor"
},
{
"elapsed": 165,
"rate": 165.365,
"type": "BenchmarkProcessorSysbench"
}
],
"manufacturer": "Intel Corp.",
"model": "Intel Atom CPU N455 @ 1.66GHz",
"serialNumber": null,
"speed": 1.667,
"threads": 2,
"type": "Processor"
},
{
"events": [],
"manufacturer": "Qualcomm Atheros",
"model": "AR9285 Wireless Network Adapter",
"serialNumber": "74:2f:68:8b:fd:c8",
"type": "NetworkAdapter",
"wireless": true
},
{
"events": [],
"manufacturer": "Qualcomm Atheros",
"model": "AR8152 v2.0 Fast Ethernet",
"serialNumber": "14:da:e9:42:f6:7c",
"speed": 100,
"type": "NetworkAdapter",
"wireless": false
},
{
"events": [],
"format": "DIMM",
"interface": "DDR2",
"manufacturer": null,
"model": null,
"serialNumber": null,
"size": 1024,
"speed": 667.0,
"type": "RamModule"
},
{
"events": [],
"manufacturer": "Intel Corporation",
"model": "NM10/ICH7 Family High Definition Audio Controller",
"serialNumber": null,
"type": "SoundCard"
},
{
"events": [],
"manufacturer": "Azurewave",
"model": "USB 2.0 UVC VGA WebCam",
"serialNumber": "0x0001",
"type": "SoundCard"
},
{
"events": [
{
"endTime": "2018-11-24T22:00:39.643726+00:00",
"severity": "Info",
"startTime": "2018-11-24T18:12:42.641985+00:00",
"steps": [
{
"endTime": "2018-11-24T19:28:51.215882+00:00",
"severity": "Info",
"startTime": "2018-11-24T18:12:42.643104+00:00",
"type": "StepZero"
},
{
"endTime": "2018-11-24T22:00:39.642482+00:00",
"severity": "Info",
"startTime": "2018-11-24T19:28:51.216747+00:00",
"type": "StepRandom"
}
],
"type": "EraseSectors"
},
{
"assessment": true,
"currentPendingSectorCount": 0,
"elapsed": 99,
"length": "Short",
"lifetime": 1199,
"offlineUncorrectable": 0,
"powerCycleCount": 2128,
"reallocatedSectorCount": 0,
"severity": "Info",
"status": "Completed without error",
"type": "TestDataStorage"
},
{
"type": "Install",
"elapsed": 1000,
"name": "LinuxMintFSAx32-Eng.fsa",
"address": 32
},
{
"elapsed": 16,
"readSpeed": 66.1,
"type": "BenchmarkDataStorage",
"writeSpeed": 21.8
}
],
"interface": "ATA",
"manufacturer": "Hitachi",
"model": "HTS54322",
"serialNumber": "E2024242CV86HJ",
"size": 238475,
"type": "HardDrive"
},
{
"events": [],
"manufacturer": "Intel Corporation",
"memory": 256.0,
"model": "Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller",
"serialNumber": null,
"type": "GraphicCard"
},
{
"events": [],
"firewire": 0,
"manufacturer": "ASUSTeK Computer INC.",
"model": "1001PXD",
"pcmcia": 0,
"serial": 1,
"serialNumber": "Eee0123456789",
"slots": 2,
"type": "Motherboard",
"usb": 5
}
],
"device": {
"chassis": "Netbook",
"events": [
{
"elapsed": 16,
"rate": 15.9165,
"type": "BenchmarkRamSysbench"
},
{
"elapsed": 60,
"severity": "Info",
"type": "StressTest"
},
{
"appearanceRange": "A",
"biosRange": "A",
"functionalityRange": "A",
"type": "WorkbenchRate"
}
],
"manufacturer": "ASUSTeK Computer INC.",
"model": "1001PXD",
"serialNumber": "B8OAAS048286",
"tags": [
{
"id": "04e4bc5af95980",
"type": "Tag"
}
],
"type": "Laptop"
},
"elapsed": 14725,
"endTime": "2018-11-24T18:06:37.611704+00:00",
"expectedEvents": [
"Benchmark",
"TestDataStorage",
"StressTest",
"EraseBasic",
"Install"
],
"software": "Workbench",
"type": "Snapshot",
"uuid": "f6cba71f-0ac1-4aba-8b6a-c1fd56ab483d",
"version": "11.0b2"
}

View File

@ -521,6 +521,7 @@ class Install(JoinedWithOneDeviceMixin, EventWithOneDevice):
storage unit. storage unit.
""" """
elapsed = Column(Interval, nullable=False) elapsed = Column(Interval, nullable=False)
address = Column(SmallInteger, check_range('address', 8, 256))
class SnapshotRequest(db.Model): class SnapshotRequest(db.Model):

View File

@ -124,11 +124,15 @@ class Snapshot(EventWithOneDevice):
class Install(EventWithOneDevice): class Install(EventWithOneDevice):
name = ... # type: Column
elapsed = ... # type: Column
address = ... # type: Column
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None:
super().__init__(**kwargs) super().__init__(**kwargs)
self.name = ... # type: str self.name = ... # type: str
self.elapsed = ... # type: timedelta self.elapsed = ... # type: timedelta
self.success = ... # type: bool self.address = ... # type: Optional[int]
class SnapshotRequest(Model): class SnapshotRequest(Model):

View File

@ -2,7 +2,7 @@ from flask import current_app as app
from marshmallow import Schema as MarshmallowSchema, ValidationError, fields as f, validates_schema from marshmallow import Schema as MarshmallowSchema, ValidationError, fields as f, validates_schema
from marshmallow.fields import Boolean, DateTime, Decimal, Float, Integer, List, Nested, String, \ from marshmallow.fields import Boolean, DateTime, Decimal, Float, Integer, List, Nested, String, \
TimeDelta, UUID TimeDelta, UUID
from marshmallow.validate import Length, Range from marshmallow.validate import Length, OneOf, Range
from sqlalchemy.util import OrderedSet from sqlalchemy.util import OrderedSet
from teal.enums import Country, Currency, Subdivision from teal.enums import Country, Currency, Subdivision
from teal.marshmallow import EnumField, IP, SanitizedStr, URL, Version from teal.marshmallow import EnumField, IP, SanitizedStr, URL, Version
@ -205,6 +205,7 @@ class Install(EventWithOneDevice):
required=True, required=True,
description='The name of the OS installed.') description='The name of the OS installed.')
elapsed = TimeDelta(precision=TimeDelta.SECONDS, required=True) elapsed = TimeDelta(precision=TimeDelta.SECONDS, required=True)
address = Integer(validate=OneOf({8, 16, 32, 64, 128, 256}))
class Snapshot(EventWithOneDevice): class Snapshot(EventWithOneDevice):