add new named branches

This commit is contained in:
xssfox 2024-09-08 09:47:42 +10:00
parent 651c258c7f
commit c8045797fb
2 changed files with 31 additions and 9 deletions

View File

@ -310,14 +310,15 @@ def telemetry_filter(telemetry):
return ("errors",f"SondeMonitor version is out of date and doesn't handle DFM radiosondes correctly. Please update to 6.2.8.8 or later") return ("errors",f"SondeMonitor version is out of date and doesn't handle DFM radiosondes correctly. Please update to 6.2.8.8 or later")
if telemetry["software_name"] == "rdzTTGOsonde": if telemetry["software_name"] == "rdzTTGOsonde":
ttgo_branch, ttgo_version = parse_rdz_ttgo_version(telemetry["software_version"]) ttgo_branch, ttgo_version = parse_rdz_ttgo_version(telemetry["software_version"])
if ttgo_branch == "devel": if ttgo_branch not in ["main", "dev"]: # presume that this is fixed in the new named branch releases
if ttgo_version < (20230427,0,0): if ttgo_branch == "devel":
return ("errors",f"rdzTTGOsonde version is out of date and doesn't handle DFM radiosondes correctly. Please update to master 0.9.3, devel20230427 or later") if ttgo_version < (20230427,0,0):
elif ttgo_branch == "master": return ("errors",f"rdzTTGOsonde version is out of date and doesn't handle DFM radiosondes correctly. Please update to master 0.9.3, devel20230427 or later")
if ttgo_version < (0,9,3): elif ttgo_branch == "master":
return ("errors",f"rdzTTGOsonde version is out of date and doesn't handle DFM radiosondes correctly. Please update to master 0.9.3, devel20230427 or later") if ttgo_version < (0,9,3):
else: return ("errors",f"rdzTTGOsonde version is out of date and doesn't handle DFM radiosondes correctly. Please update to master 0.9.3, devel20230427 or later")
return ("errors",f"rdzTTGOsonde branch and version was unable to be determined. We are unsure if this version handles DFM sondes correctly. Please update to master 0.9.3, devel20230427 or later") else:
return ("errors",f"rdzTTGOsonde branch and version was unable to be determined. We are unsure if this version handles DFM sondes correctly. Please update to master 0.9.3, devel20230427 or later")
# Check if DFM17->DFM09 misid - https://github.com/projecthorus/sondehub-infra/issues/141 # Check if DFM17->DFM09 misid - https://github.com/projecthorus/sondehub-infra/issues/141
if "subtype" in telemetry and telemetry["subtype"] == "DFM09": if "subtype" in telemetry and telemetry["subtype"] == "DFM09":
try: try:
@ -357,7 +358,7 @@ def parse_rdz_ttgo_version(version):
# RDZ TTGO has two branches, master and devel, however there are also a bunch of other custom versions # RDZ TTGO has two branches, master and devel, however there are also a bunch of other custom versions
# devel20230829, master_v0.9.3, master_v0.9.2, devel20230427, devLZ20230812, devel20230829.NE, Alex_ver_2.7_M, multich_v3 # devel20230829, master_v0.9.3, master_v0.9.2, devel20230427, devLZ20230812, devel20230829.NE, Alex_ver_2.7_M, multich_v3
# in the cases that don't match develxxxx or master_vxxxx format we'll give a 0,0,0 version here # in the cases that don't match develxxxx or master_vxxxx format we'll give a 0,0,0 version here
m = re.search(r'([a-zA-Z_]+?)_?v?(\d+)(?:\.(\d+))?(?:\.(\d+))?', version) m = re.search(r'([a-zA-Z_]+?)(?:_v)?(\d+)(?:\.(\d+))?(?:\.(\d+))?', version)
return (m.groups()[0],tuple([int(x if x != None else 0) for x in m.groups()[1:]])) return (m.groups()[0],tuple([int(x if x != None else 0) for x in m.groups()[1:]]))
except: except:
return ("unknown", (0,0,0)) return ("unknown", (0,0,0))

View File

@ -135,6 +135,27 @@ class TestIngestion(unittest.TestCase):
sns.publish.assert_called() sns.publish.assert_called()
self.assertEqual(output["body"], "^v^ telm logged") self.assertEqual(output["body"], "^v^ telm logged")
self.assertEqual(output["statusCode"], 200) self.assertEqual(output["statusCode"], 200)
def test_good_ttgo_devel_payload_new_name(self):
payload = copy.deepcopy(example_body)
payload[0]["datetime"] = datetime.datetime.now().isoformat()
payload[0]["software_name"] = "rdzTTGOsonde"
payload[0]["software_version"] = "dev20230829"
payload[0]["type"] = "DFM"
output = lambda_handler(compress_payload(payload), fakeContext())
sns.publish.assert_called()
self.assertEqual(output["body"], "^v^ telm logged")
self.assertEqual(output["statusCode"], 200)
def test_good_ttgo_main_payload(self):
payload = copy.deepcopy(example_body)
payload[0]["datetime"] = datetime.datetime.now().isoformat()
payload[0]["software_name"] = "rdzTTGOsonde"
payload[0]["software_version"] = "main1234"
payload[0]["type"] = "DFM"
output = lambda_handler(compress_payload(payload), fakeContext())
sns.publish.assert_called()
self.assertEqual(output["body"], "^v^ telm logged")
self.assertEqual(output["statusCode"], 200)
def test_bad_ttgo_devel_payload(self): def test_bad_ttgo_devel_payload(self):
payload = copy.deepcopy(example_body) payload = copy.deepcopy(example_body)
payload[0]["datetime"] = datetime.datetime.now().isoformat() payload[0]["datetime"] = datetime.datetime.now().isoformat()