Skip to content

Commit

Permalink
feat: Make most fields in big query diagnostic schema as optional #404 (
Browse files Browse the repository at this point in the history
#420)

* start using new schema for diagnostic data

Co-authored-by: Pritam Ghanghas <pghanghas@nebra.com>
  • Loading branch information
pritamghanghas and Pritam Ghanghas authored Aug 1, 2022
1 parent 56a2c3d commit e43a92a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions bigquery/diag_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,37 @@
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "BN",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "ID",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "BA",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "FR",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "FW",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "VA",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "serial_number",
"type": "STRING"
},
Expand All @@ -65,17 +65,17 @@
"type": "BOOLEAN"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "PK",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "OK",
"type": "STRING"
},
{
"mode": "REQUIRED",
"mode": "NULLABLE",
"name": "AN",
"type": "STRING"
},
Expand Down
20 changes: 10 additions & 10 deletions hw_diag/diagnostics/bigquery_data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ class DiagnosticDataModel(BaseModel):
last_updated: str
E0: Optional[str]
W0: Optional[str]
BN: str
ID: str
BA: str
FR: str
FW: str
VA: str
serial_number: str
BN: Optional[str]
ID: Optional[str]
BA: Optional[str]
FR: Optional[str]
FW: Optional[str]
VA: Optional[str]
serial_number: Optional[str]
ECC: Optional[bool]
LOR: Optional[bool]
PK: str
OK: str
AN: str
PK: Optional[str]
OK: Optional[str]
AN: Optional[str]
MC: Optional[bool]
MD: Optional[bool]
MH: Optional[int]
Expand Down
2 changes: 1 addition & 1 deletion hw_diag/tests/test_gcs_shipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_diagnostics_missing_required_field(self, mock_requests):
mock_requests.post = MagicMock()
mock_requests.post.return_value = OKResponse()
diag_data = valid_diagnostic_data().copy()
diag_data.pop('serial_number')
diag_data.pop('last_updated')
retval = upload_diagnostics(diag_data, True)
self.assertFalse(retval)

Expand Down

0 comments on commit e43a92a

Please sign in to comment.