Skip to content

Commit

Permalink
fix: upgrade cosn version and unit test incompatible problem (#163)
Browse files Browse the repository at this point in the history
* feat: add unit test and convering client-side issues

* fix: upgrade cosn version and unit test incompatible problem
  • Loading branch information
hushengquan authored Jan 9, 2025
1 parent e90f157 commit 2cdc2b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.qcloud.cos</groupId>
<artifactId>hadoop-cos</artifactId>
<version>8.3.14</version>
<version>8.3.15</version>
<packaging>jar</packaging>

<name>Apache Hadoop Tencent Cloud COS Support</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.apache.hadoop.fs;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.hadoop.conf.Configuration;
import org.junit.After;
import org.junit.AfterClass;
Expand All @@ -9,12 +8,15 @@

import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
import java.security.SecureRandom;

public class CosNFileSystemTestBase extends CosNFileSystemTestWithTimeout {
protected static Configuration configuration;
protected static FileSystem fs;
static Random random = new Random();

protected static final Path unittestDirPath = new Path("/unittest-dir" + RandomStringUtils.randomAlphanumeric(8));
protected static final Path unittestDirPath = new Path("/unittest-dir" + random.nextInt());
protected final Path testDirPath = new Path(unittestDirPath, "test-dir");
protected final Path testFilePath = new Path(unittestDirPath, "test-file");

Expand Down Expand Up @@ -87,7 +89,8 @@ protected Path methodPath() throws IOException {
*/
protected static byte[] getTestData(int size) {
byte[] testData = new byte[size];
System.arraycopy(RandomStringUtils.randomAlphabetic(size).getBytes(), 0, testData, 0, size);
SecureRandom secureRandom = new SecureRandom();
secureRandom.nextBytes(testData); // 生成随机字节
return testData;
}

Expand Down

0 comments on commit 2cdc2b8

Please sign in to comment.