resolve conflict CHANGELOG
This commit is contained in:
commit
2e11a9f28f
|
@ -16,3 +16,4 @@ ml).
|
||||||
- [fixed] #89 save json on disk only for shapshots
|
- [fixed] #89 save json on disk only for shapshots
|
||||||
- [addend] #83 add owner_id in all kind of device
|
- [addend] #83 add owner_id in all kind of device
|
||||||
- [addend] #85 add mac of network adapter to device hid
|
- [addend] #85 add mac of network adapter to device hid
|
||||||
|
- [fixed] #91 The most old time allow is 1970-01-01
|
||||||
|
|
|
@ -41,6 +41,15 @@ class Action(Thing):
|
||||||
parent = NestedOn(s_device.Computer, dump_only=True, description=m.Action.parent_id.comment)
|
parent = NestedOn(s_device.Computer, dump_only=True, description=m.Action.parent_id.comment)
|
||||||
url = URL(dump_only=True, description=m.Action.url.__doc__)
|
url = URL(dump_only=True, description=m.Action.url.__doc__)
|
||||||
|
|
||||||
|
@validates_schema
|
||||||
|
def validate_times(self, data: dict):
|
||||||
|
unix_time = datetime.fromisoformat("1970-01-02 00:00:00+00:00")
|
||||||
|
if 'end_time' in data and data['end_time'] < unix_time:
|
||||||
|
data['end_time'] = unix_time
|
||||||
|
|
||||||
|
if 'start_time' in data and data['start_time'] < unix_time:
|
||||||
|
data['start_time'] = unix_time
|
||||||
|
|
||||||
|
|
||||||
class ActionWithOneDevice(Action):
|
class ActionWithOneDevice(Action):
|
||||||
__doc__ = m.ActionWithOneDevice.__doc__
|
__doc__ = m.ActionWithOneDevice.__doc__
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
{
|
||||||
|
"closed": true,
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"manufacturer": "Intel Corporation",
|
||||||
|
"model": "NM10/ICH7 Family High Definition Audio Controller",
|
||||||
|
"serialNumber": null,
|
||||||
|
"type": "SoundCard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"manufacturer": "Azurewave",
|
||||||
|
"model": "USB 2.0 UVC VGA WebCam",
|
||||||
|
"serialNumber": "0x0001",
|
||||||
|
"type": "SoundCard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"format": "DIMM",
|
||||||
|
"interface": "DDR2",
|
||||||
|
"manufacturer": null,
|
||||||
|
"model": null,
|
||||||
|
"serialNumber": null,
|
||||||
|
"size": 1024,
|
||||||
|
"speed": 667.0,
|
||||||
|
"type": "RamModule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": 64,
|
||||||
|
"cores": 1,
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"elapsed": 165,
|
||||||
|
"rate": 164.8342,
|
||||||
|
"type": "BenchmarkProcessorSysbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"elapsed": 0,
|
||||||
|
"rate": 6665.7,
|
||||||
|
"type": "BenchmarkProcessor"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"manufacturer": "Intel Corp.",
|
||||||
|
"model": "Intel Atom CPU N455 @ 1.66GHz",
|
||||||
|
"serialNumber": null,
|
||||||
|
"speed": 1.667,
|
||||||
|
"threads": 2,
|
||||||
|
"type": "Processor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"elapsed": 16,
|
||||||
|
"readSpeed": 66.2,
|
||||||
|
"type": "BenchmarkDataStorage",
|
||||||
|
"writeSpeed": 21.8
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"interface": "ATA",
|
||||||
|
"manufacturer": "Hitachi",
|
||||||
|
"model": "HTS54322",
|
||||||
|
"serialNumber": "E2024242CV86HJ",
|
||||||
|
"size": 238475,
|
||||||
|
"type": "HardDrive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"manufacturer": "Qualcomm Atheros",
|
||||||
|
"model": "AR9285 Wireless Network Adapter",
|
||||||
|
"serialNumber": "74:2f:68:8b:fd:c8",
|
||||||
|
"type": "NetworkAdapter",
|
||||||
|
"wireless": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"manufacturer": "Qualcomm Atheros",
|
||||||
|
"model": "AR8152 v2.0 Fast Ethernet",
|
||||||
|
"serialNumber": "14:da:e9:42:f6:7c",
|
||||||
|
"speed": 100,
|
||||||
|
"type": "NetworkAdapter",
|
||||||
|
"wireless": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"manufacturer": "Intel Corporation",
|
||||||
|
"memory": 256.0,
|
||||||
|
"model": "Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller",
|
||||||
|
"serialNumber": null,
|
||||||
|
"type": "GraphicCard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "TestBios",
|
||||||
|
"accessRange": "A",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"firewire": 0,
|
||||||
|
"manufacturer": "ASUSTeK Computer INC.",
|
||||||
|
"model": "1001PXD",
|
||||||
|
"pcmcia": 0,
|
||||||
|
"serial": 1,
|
||||||
|
"serialNumber": "Eee0123456789",
|
||||||
|
"slots": 2,
|
||||||
|
"type": "Motherboard",
|
||||||
|
"usb": 5
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"device": {
|
||||||
|
"chassis": "Netbook",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"elapsed": 16,
|
||||||
|
"rate": 15.8978,
|
||||||
|
"type": "BenchmarkRamSysbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearanceRange": "A",
|
||||||
|
"functionalityRange": "A",
|
||||||
|
"type": "VisualTest"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"manufacturer": "ASUSTeK Computer INC.",
|
||||||
|
"model": "1001PXD",
|
||||||
|
"serialNumber": "B8OAAS048286",
|
||||||
|
"type": "Laptop"
|
||||||
|
},
|
||||||
|
"elapsed": 6,
|
||||||
|
"endTime": "0001-01-01 00:00:00+00:00",
|
||||||
|
"software": "Workbench",
|
||||||
|
"type": "Snapshot",
|
||||||
|
"uuid": "7dc4d19c-914e-4652-a381-d641325fb9c2",
|
||||||
|
"version": "11.0a6"
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ import copy
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from dateutil.tz import tzutc
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Tuple, Type
|
from typing import Tuple, Type
|
||||||
|
|
||||||
|
@ -502,8 +503,8 @@ def test_allocate_bad_dates(user: UserClient):
|
||||||
""" Tests allocate """
|
""" Tests allocate """
|
||||||
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
||||||
device_id = snapshot['device']['id']
|
device_id = snapshot['device']['id']
|
||||||
delta = timedelta(days=30)
|
delay = timedelta(days=30)
|
||||||
future = datetime.now() + delta
|
future = datetime.now().replace(tzinfo=tzutc()) + delay
|
||||||
post_request = {"transaction": "ccc",
|
post_request = {"transaction": "ccc",
|
||||||
"finalUserCode": "aabbcc",
|
"finalUserCode": "aabbcc",
|
||||||
"name": "John",
|
"name": "John",
|
||||||
|
@ -556,8 +557,8 @@ def test_deallocate_bad_dates(user: UserClient):
|
||||||
""" Tests deallocate with bad date of start_time """
|
""" Tests deallocate with bad date of start_time """
|
||||||
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
||||||
device_id = snapshot['device']['id']
|
device_id = snapshot['device']['id']
|
||||||
delta = timedelta(days=30)
|
delay = timedelta(days=30)
|
||||||
future = datetime.now() + delta
|
future = datetime.now().replace(tzinfo=tzutc()) + delay
|
||||||
post_deallocate = {"startTime": future,
|
post_deallocate = {"startTime": future,
|
||||||
"devices": [device_id]
|
"devices": [device_id]
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,3 +727,37 @@ def test_snapshot_failed_missing_chassis(app: Devicehub, user: UserClient):
|
||||||
assert snapshot['version'] == snapshot_error['version']
|
assert snapshot['version'] == snapshot_error['version']
|
||||||
assert snapshot['uuid'] == uuid
|
assert snapshot['uuid'] == uuid
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
def test_snapshot_failed_end_time_bug(app: Devicehub, user: UserClient):
|
||||||
|
""" This test check if the end_time = 0001-01-01 00:00:00+00:00
|
||||||
|
and then we get a /devices, this create a crash
|
||||||
|
"""
|
||||||
|
snapshot_file = file('asus-end_time_bug88.snapshot')
|
||||||
|
snapshot, _ = user.post(res=Snapshot, data=snapshot_file)
|
||||||
|
device, _ = user.get(res=m.Device, item=snapshot['device']['id'])
|
||||||
|
end_times = [x['endTime'] for x in device['actions']]
|
||||||
|
|
||||||
|
assert '1970-01-02T00:00:00+00:00' in end_times
|
||||||
|
assert not '0001-01-01T00:00:00+00:00' in end_times
|
||||||
|
|
||||||
|
tmp_snapshots = app.config['TMP_SNAPSHOTS']
|
||||||
|
shutil.rmtree(tmp_snapshots)
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
def test_snapshot_not_failed_end_time_bug(app: Devicehub, user: UserClient):
|
||||||
|
""" This test check if the end_time != 0001-01-01 00:00:00+00:00
|
||||||
|
and then we get a /devices, this create a crash
|
||||||
|
"""
|
||||||
|
snapshot_file = file('asus-end_time_bug88.snapshot')
|
||||||
|
snapshot_file['endTime'] = '2001-01-01 00:00:00+00:00'
|
||||||
|
snapshot, _ = user.post(res=Snapshot, data=snapshot_file)
|
||||||
|
device, _ = user.get(res=m.Device, item=snapshot['device']['id'])
|
||||||
|
end_times = [x['endTime'] for x in device['actions']]
|
||||||
|
|
||||||
|
assert not '1970-01-02T00:00:00+00:00' in end_times
|
||||||
|
assert not '0001-01-01T00:00:00+00:00' in end_times
|
||||||
|
assert '2001-01-01T00:00:00+00:00' in end_times
|
||||||
|
|
||||||
|
tmp_snapshots = app.config['TMP_SNAPSHOTS']
|
||||||
|
shutil.rmtree(tmp_snapshots)
|
||||||
|
|
Reference in New Issue