Skip to content

Commit

Permalink
[JENKINS-18861] assert max loads using assertMaxLoads
Browse files Browse the repository at this point in the history
.
  • Loading branch information
ssogabe committed Aug 13, 2013
1 parent a644fad commit e67447e
Showing 1 changed file with 5 additions and 6 deletions.
Expand Up @@ -6,10 +6,10 @@
import hudson.plugins.view.dashboard.RunLoadCounter;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import org.junit.Test;
import org.junit.Rule;
import org.jvnet.hudson.test.JenkinsRule;
import static org.junit.Assert.assertTrue;

public class LatestBuildsTest {

Expand All @@ -34,13 +34,12 @@ protected List<Job> getDashboardJobs() {

};

int actual = RunLoadCounter.countLoads(p, new Runnable() {
public void run() {
List<Run> builds = latest.getFinishedBuilds();
RunLoadCounter.assertMaxLoads(p, numbuilds, new Callable<List<Run>>() {

public List<Run> call() throws Exception {
return latest.getFinishedBuilds();
}
});
assertTrue(actual <= numbuilds);

}

}

1 comment on commit e67447e

@jglick
Copy link
Member

@jglick jglick commented on e67447e Aug 13, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that if you care to do so, you can also use the return value from assertMaxLoads, in this case to assert that finishedBuilds is actually correct (which may already be tested adequately elsewhere).

Please sign in to comment.