def test_configure(self, glue2_mock, glue13_mock): configuration = get_default_test_configuration() gateway = get_default_storm_gateway() ip = StormInfoProvider(configuration=configuration, gateway=gateway, glue13=glue13_mock, glue2=glue2_mock) ip.configure("all", "/tmp/report.json")
def test_static_ldif(self): configuration = get_default_test_configuration() gateway = get_default_storm_gateway() spaceinfo = SpaceInfoBuilder(configuration, gateway).build() glue2 = Glue2(configuration) nodes = glue2.get_static_ldif_nodes(spaceinfo) self._check_generated_storage_service(nodes[0].get_info(), configuration) self._check_generated_storage_service_capacity(nodes[1].get_info(), configuration, spaceinfo)
def test_get_update_ldif(self, glue2_mock, glue13_mock): configuration = get_default_test_configuration() gateway = get_default_storm_gateway() ip = StormInfoProvider(configuration=configuration, gateway=gateway, glue13=glue13_mock, glue2=glue2_mock) ip.get_update_ldif("glue13") ip.get_update_ldif("glue2")
def test_space_info_builder_with_default_configuration(self): configuration = get_default_test_configuration() gateway = get_default_storm_gateway() spaceinfo = SpaceInfoBuilder(configuration, gateway).build() expected_summary = get_default_space_info_summary() self.assertEqual(spaceinfo.get_summary().get_total(), expected_summary.get_total()) self.assertEqual(spaceinfo.get_summary().get_available(), expected_summary.get_available()) self.assertEqual(spaceinfo.get_summary().get_used(), expected_summary.get_used()) self.assertEqual(spaceinfo.get_summary().get_free(), expected_summary.get_free()) self.assertEqual(spaceinfo.get_summary().get_unavailable(), expected_summary.get_unavailable()) self.assertEqual(spaceinfo.get_summary().get_reserved(), expected_summary.get_reserved()) self.assertEqual(spaceinfo.get_summary().get_busy(), expected_summary.get_busy()) self.assertEqual(spaceinfo.get_summary().get_nearline(), expected_summary.get_nearline())
def test_space_info_builder_with_default_configuration_but_serving_state_closed(self): configuration = get_default_test_configuration() configuration.set("STORM_SERVING_STATE", "closed") gateway = get_default_storm_gateway() spaceinfo = SpaceInfoBuilder(configuration, gateway).build() expected_summary = get_default_space_info_summary_from_configuration() self.assertEqual(spaceinfo.get_summary().get_total(), expected_summary.get_total()) self.assertEqual(spaceinfo.get_summary().get_available(), expected_summary.get_available()) self.assertEqual(spaceinfo.get_summary().get_used(), expected_summary.get_used()) self.assertEqual(spaceinfo.get_summary().get_free(), expected_summary.get_free()) self.assertEqual(spaceinfo.get_summary().get_unavailable(), expected_summary.get_unavailable()) self.assertEqual(spaceinfo.get_summary().get_reserved(), expected_summary.get_reserved()) self.assertEqual(spaceinfo.get_summary().get_busy(), expected_summary.get_busy()) self.assertEqual(spaceinfo.get_summary().get_nearline(), expected_summary.get_nearline())
def test_space_info_builder_with_default_configuration_but_serving_state_closed( self): configuration = get_default_test_configuration() configuration.set("STORM_SERVING_STATE", "closed") gateway = get_default_storm_gateway() spaceinfo = SpaceInfoBuilder(configuration, gateway).build() expected_summary = get_default_space_info_summary_from_configuration() self.assertEqual(spaceinfo.get_summary().get_total(), expected_summary.get_total()) self.assertEqual(spaceinfo.get_summary().get_available(), expected_summary.get_available()) self.assertEqual(spaceinfo.get_summary().get_used(), expected_summary.get_used()) self.assertEqual(spaceinfo.get_summary().get_free(), expected_summary.get_free()) self.assertEqual(spaceinfo.get_summary().get_unavailable(), expected_summary.get_unavailable()) self.assertEqual(spaceinfo.get_summary().get_reserved(), expected_summary.get_reserved()) self.assertEqual(spaceinfo.get_summary().get_busy(), expected_summary.get_busy()) self.assertEqual(spaceinfo.get_summary().get_nearline(), expected_summary.get_nearline())
def test_get_report_json(self): configuration = get_default_test_configuration() gateway = get_default_storm_gateway() ip = StormInfoProvider(configuration=configuration, gateway=gateway) ip.get_report_json("/tmp/report.json")
def test_storage_service_builder(self): configuration = get_default_test_configuration() storm_gateway = get_default_storm_gateway() # build space info space_info = SpaceInfoBuilder(configuration, storm_gateway).build() # build storage service and check results service = StorageServiceBuilder(configuration, space_info).build() self.assertEqual(service.get_name(), configuration.get_sitename()) self.assertEqual(service.get_implementation(), "storm") self.assertEqual(service.get_implementation_version(), configuration.get_implementation_version()) self.assertEqual(service.get_quality_level(), configuration.get_quality_level()) self.assertNotEqual( service.get_capabilities().index("data.management.transfer"), -1) self.assertNotEqual( service.get_capabilities().index("data.management.storage"), -1) self.assertIsNotNone(service.get_latest_update()) self.assertEqual(len(service.get_storage_endpoints()), 4) # SRM self.assertEqual(service.get_storage_endpoints()[0].get_url(), configuration.get_public_srm_endpoint()) self.assertEqual(service.get_storage_endpoints()[0].get_type(), "srm") self.assertEqual(service.get_storage_endpoints()[0].get_version(), "2.2") self.assertEqual(service.get_storage_endpoints()[0].get_name(), "SRM_0") self.assertEqual( service.get_storage_endpoints()[0].get_quality_level(), configuration.get_quality_level()) self.assertNotEqual( service.get_storage_endpoints()[0].get_capabilities().index( "data.management.transfer"), -1) self.assertNotEqual( service.get_storage_endpoints()[0].get_capabilities().index( "data.management.storage"), -1) self.assertEqual( service.get_storage_endpoints()[0].get_assigned_shares(), ["all"]) # WebDAV - HTTP 8085 self.assertEqual(service.get_storage_endpoints()[1].get_url(), configuration.get_webdav_endpoints()[0]) self.assertEqual(service.get_storage_endpoints()[1].get_type(), "DAV") self.assertEqual(service.get_storage_endpoints()[1].get_version(), "1.1") self.assertEqual(service.get_storage_endpoints()[1].get_name(), "HTTP_0") self.assertEqual( service.get_storage_endpoints()[1].get_quality_level(), configuration.get_quality_level()) self.assertNotEqual( service.get_storage_endpoints()[1].get_capabilities().index( "data.management.transfer"), -1) self.assertNotEqual( service.get_storage_endpoints()[1].get_capabilities().index( "data.management.storage"), -1) self.assertEqual( service.get_storage_endpoints()[1].get_assigned_shares(), ["all"]) # WebDAV - HTTPS 8443 self.assertEqual(service.get_storage_endpoints()[2].get_url(), configuration.get_webdav_endpoints()[1]) self.assertEqual(service.get_storage_endpoints()[2].get_type(), "DAV") self.assertEqual(service.get_storage_endpoints()[2].get_version(), "1.1") self.assertEqual(service.get_storage_endpoints()[2].get_name(), "HTTPS_0") self.assertEqual( service.get_storage_endpoints()[2].get_quality_level(), configuration.get_quality_level()) self.assertNotEqual( service.get_storage_endpoints()[2].get_capabilities().index( "data.management.transfer"), -1) self.assertNotEqual( service.get_storage_endpoints()[2].get_capabilities().index( "data.management.storage"), -1) self.assertEqual( service.get_storage_endpoints()[2].get_assigned_shares(), ["all"]) # WebDAV - HTTPS another-host 8443 self.assertEqual(service.get_storage_endpoints()[3].get_url(), configuration.get_webdav_endpoints()[2]) self.assertEqual(service.get_storage_endpoints()[3].get_type(), "DAV") self.assertEqual(service.get_storage_endpoints()[3].get_version(), "1.1") self.assertEqual(service.get_storage_endpoints()[3].get_name(), "HTTPS_1") self.assertEqual( service.get_storage_endpoints()[3].get_quality_level(), configuration.get_quality_level()) self.assertNotEqual( service.get_storage_endpoints()[3].get_capabilities().index( "data.management.transfer"), -1) self.assertNotEqual( service.get_storage_endpoints()[3].get_capabilities().index( "data.management.storage"), -1) self.assertEqual( service.get_storage_endpoints()[3].get_assigned_shares(), ["all"]) # check storage shares self.assertEqual(len(service.get_storage_shares()), 7) # check it's a valid JSON string report = Report(storage_service=service) json.loads(report.to_json()) logging.debug(report.to_json())