-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3354 from jsonwan/github_perf/execute
perf: 选择任意一个容器执行时使用随机算法 #3352
- Loading branch information
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...end/commons/common-utils/src/test/java/com/tencent/bk/job/common/util/RandomUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.tencent.bk.job.common.util; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; | ||
|
||
public class RandomUtilTest { | ||
|
||
@Test | ||
void testNextInt() { | ||
for (int i = 0; i < 100; i++) { | ||
int bound = RandomUtil.nextInt(1000) + 1; | ||
assertThat(RandomUtil.nextInt(bound)).isGreaterThanOrEqualTo(0); | ||
assertThat(RandomUtil.nextInt(bound)).isLessThan(bound); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters