Skip to content

Commit

Permalink
improve unit test stability
Browse files Browse the repository at this point in the history
  • Loading branch information
areyouok committed Oct 14, 2023
1 parent bce1963 commit 652d411
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
cache: maven
- name: Build with coveralls report
if: ${{ env.cov_token != '' }}
run: mvn -B -DjacocoReports=jetcache-test/target/site/jacoco-aggregate/jacoco.xml clean test jacoco:report-aggregate coveralls:report -DrepoToken=${{ secrets.COV_TOKEN }}
run: mvn -B -DjacocoReports=jetcache-test/target/site/jacoco-aggregate/jacoco.xml clean test jacoco:report-aggregate coveralls:report -DrepoToken=${{ secrets.COV_TOKEN }} -Dtick=3
- name: Build without coveralls report
if: ${{ env.cov_token == '' }}
run: mvn -B clean test
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Function;

import static com.alicp.jetcache.test.support.Tick.tick;

/**
* Created on 2016/10/8.
*
Expand Down Expand Up @@ -928,7 +930,7 @@ private static class PenetrationTestThread extends Thread {
this.cache = cache;
this.loader = k -> {
try {
Thread.sleep(75);
Thread.sleep(tick(50));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright The Dongting Project
*
* The Dongting Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.alicp.jetcache.test.support;

/**
* @author huangli
*/
public class Tick {
private static final int TICK = Integer.parseInt(System.getProperty("tick", "1"));

public static int tick(int value) {
return value * TICK;
}

public static long tick(long value) {
return value * TICK;
}
}

0 comments on commit 652d411

Please sign in to comment.