SWJTU-ZhangLei commented on code in PR #48073: URL: https://github.com/apache/doris/pull/48073#discussion_r1978894539
########## fe/fe-core/src/main/java/org/apache/doris/catalog/AzureResource.java: ########## @@ -78,21 +81,56 @@ protected void setProperties(Map<String, String> newProperties) throws DdlExcept this.properties = newProperties; } - private static void pingAzure(String bucketName, String rootPath, + protected static void pingAzure(String bucketName, String rootPath, Map<String, String> newProperties) throws DdlException { - if (FeConstants.runningUnitTest) { - return; + + String testFile = "azure://" + bucketName + "/" + rootPath + "/" + + UUID.randomUUID().toString() + "/test-object-valid.txt"; + + byte[] contentData = new byte[2 * ObjStorage.CHUNK_SIZE]; + Arrays.fill(contentData, (byte) 'A'); + AzureObjStorage azureObjStorage = new AzureObjStorage(newProperties); + + Status status = azureObjStorage.putObject(testFile, new ByteArrayInputStream(contentData), contentData.length); + if (!Status.OK.equals(status)) { + throw new DdlException( + "ping azure failed(put), status: " + status + ", properties: " + new PrintableMap<>( Review Comment: > > we may need to convert the raw message to what user can understand. e.g. if status is 403, return "failed try to test to put object, lack of permission of PUT" if status is connection refused, return "failed to connect to azure, please check your connection or endpoint" > > it is not necessary, keep the same as before Can you show me the code, what you expect to deal with -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org