def test__out_of_date_controller_generates_concise_notification(self): c1 = factory.make_RegionRackController() c2 = factory.make_RegionRackController() ControllerInfo.objects.set_version(c1, "2.3.0-500-g1") ControllerInfo.objects.set_version(c2, "2.3.1-500-g1") self.assertThat(get_version_notifications().count(), Equals(1)) self.assertThat( get_version_notifications().first().render(), Equals(KNOWN_VERSION_MISMATCH_NOTIFICATION.format( system_id=c1.system_id, hostname=c1.hostname, v1="2.3.0")))
def test__revno_differences_cause_full_version_to_be_shown(self): c1 = factory.make_RegionRackController() c2 = factory.make_RegionRackController() ControllerInfo.objects.set_version(c1, "2.3.0~beta2-6000-g123abc") ControllerInfo.objects.set_version(c2, "2.3.0~beta2-6001-g234bcd") self.assertThat(get_version_notifications().count(), Equals(1)) self.assertThat( get_version_notifications().first().render(), Equals(KNOWN_VERSION_MISMATCH_NOTIFICATION.format( system_id=c1.system_id, hostname=c1.hostname, v1="2.3.0~beta2 (6000-g123abc)")))
def test__version_qualifiers_considered(self): c1 = factory.make_RegionRackController() c2 = factory.make_RegionRackController() # Note: the revno and git revision are intentionally identical here, # so we know they don't affect the comparison of qualifiers, and we # know that useless information won't appear in the notification. ControllerInfo.objects.set_version(c1, "2.3.0~alpha1-500-g1") ControllerInfo.objects.set_version(c2, "2.3.0~alpha2-500-g1") self.assertThat(get_version_notifications().count(), Equals(1)) self.assertThat( get_version_notifications().first().render(), Equals(KNOWN_VERSION_MISMATCH_NOTIFICATION.format( system_id=c1.system_id, hostname=c1.hostname, v1="2.3.0~alpha1")))