Skip to content

Commit

Permalink
Hotfix soft launch bugs (#128)
Browse files Browse the repository at this point in the history
* Resolve 4x bugs

* Increment version in report.pdf

* Fix API test
  • Loading branch information
jboddey authored Oct 2, 2023
1 parent 07717a2 commit 3aa5bc5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/package
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ cp -r {framework,modules} $MAKE_SRC_DIR/usr/local/testrun
dpkg-deb --build --root-owner-group make

# Rename the .deb file
mv make.deb testrun_1-0_amd64.deb
mv make.deb testrun_1-0-1_amd64.deb
7 changes: 3 additions & 4 deletions framework/python/src/common/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, config_file):
self._load_config()

def start(self):
self.reset()
self._status = 'Waiting for Device'
self._started = datetime.datetime.now()

Expand Down Expand Up @@ -217,10 +218,8 @@ def get_total_tests(self):
def reset(self):
self.set_status('Idle')
self.set_target_device(None)
self._tests = {
'total': 0,
'results': []
}
self._total_tests = 0
self._results = []
self._started = None
self._finished = None

Expand Down
15 changes: 10 additions & 5 deletions framework/python/src/common/testreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@
report_resource_dir = os.path.join(root_dir,
RESOURCES_DIR)

font_file = os.path.join(report_resource_dir,'GoogleSans-Regular.ttf')
test_run_img_file = os.path.join(report_resource_dir,'testrun.png')
test_run_img_file = os.path.join(report_resource_dir, 'testrun.png')

class TestReport():
"""Represents a previous Test Run report."""
"""Represents a previous Testrun report."""

def __init__(self,
status='Non-Compliant',
Expand All @@ -52,6 +51,7 @@ def __init__(self,
self._finished = finished
self._total_tests = total_tests
self._results = []
self._report_url = ''

def get_status(self):
return self._status
Expand Down Expand Up @@ -80,6 +80,7 @@ def to_json(self):
report_json['finished'] = self._finished.strftime(DATE_TIME_FORMAT)
report_json['tests'] = {'total': self._total_tests,
'results': self._results}
report_json['report'] = self._report_url
return report_json

def from_json(self, json_file):
Expand All @@ -88,12 +89,15 @@ def from_json(self, json_file):
self._device['manufacturer'] = json_file['device']['manufacturer']
self._device['model'] = json_file['device']['model']

if 'firmware' in self._device:
if 'firmware' in json_file['device']:
self._device['firmware'] = json_file['device']['firmware']

self._status = json_file['status']
self._started = datetime.strptime(json_file['started'], DATE_TIME_FORMAT)
self._finished = datetime.strptime(json_file['finished'], DATE_TIME_FORMAT)

if 'report' in json_file:
self._report_url = json_file['report']
self._total_tests = json_file['tests']['total']

# Loop through test results
Expand Down Expand Up @@ -162,7 +166,8 @@ def generate_pages(self,json_data):
return pages

def generate_page(self,json_data, page_num, max_page):
version = 'v1.0 (2023-10-02)' # Place holder until available in json report
# Placeholder until available in json report
version = 'v1.0.1 (2023-10-02)'
page = '<div class="page">'
page += self.generate_header(json_data)
if page_num == 1:
Expand Down
1 change: 0 additions & 1 deletion framework/python/src/test_orc/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ def _run_test_module(self, module):
module_results = module_results_json["results"]
for test_result in module_results:
self._session.add_test_result(test_result)
self._session.add_total_tests(1)
except (FileNotFoundError, PermissionError,
json.JSONDecodeError) as results_error:
LOGGER.error(
Expand Down
2 changes: 1 addition & 1 deletion make/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: Testrun
Version: 1.0
Version: 1.0.1
Architecture: amd64
Maintainer: Google <[email protected]>
Homepage: https://github.com/google/testrun
Expand Down
2 changes: 1 addition & 1 deletion testing/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def test_stop_running_test(testing_devices, testrun):
r = requests.post(f"{API}/system/stop")
response = json.loads(r.text)
pretty_print(response)
assert response == {"success": "Test Run stopped"}
assert response == {"success": "Testrun stopped"}
time.sleep(1)
# Validate response
r = requests.get(f"{API}/system/status")
Expand Down

0 comments on commit 3aa5bc5

Please sign in to comment.