Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ErrataCacheDriverTest: make condition robust to pre-existing Tasks

  • Loading branch information...
commit bcfc48843b42aba2a4a01a6420f7a42471763e0c 1 parent 08f79ef
@moio moio authored
View
10 java/code/src/com/redhat/rhn/taskomatic/task/test/ErrataCacheDriverTest.java
@@ -18,6 +18,7 @@
import com.redhat.rhn.common.db.datasource.WriteMode;
import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.server.test.ServerFactoryTest;
+import com.redhat.rhn.domain.task.Task;
import com.redhat.rhn.taskomatic.task.TaskConstants;
import com.redhat.rhn.taskomatic.task.errata.ErrataCacheDriver;
import com.redhat.rhn.testing.BaseTestCaseWithUser;
@@ -48,7 +49,14 @@ public void testGetCandidates() throws Exception {
// Get the candidates and verify
ErrataCacheDriver driver = new ErrataCacheDriver();
driver.setLogger(Logger.getLogger(ErrataCacheDriverTest.class));
- assertEquals(1, driver.getCandidates().size());
+ int candidateCount = 0;
+ for (Map<String, Object> candidate : driver.getCandidates()) {
+ Task task = (Task) candidate.get("task");
+ if (task.getData().equals(server.getId())) {
+ candidateCount++;
+ }
+ }
+ assertEquals(1, candidateCount);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.