Skip to content

Commit 06168eb

Browse files
committed
Attempt to resolve flakiness of BomUploadProcessingTaskTest
Are unfinished asynchronous tasks using the database a problem? 🤔 Signed-off-by: nscuro <[email protected]>
1 parent 9b96b91 commit 06168eb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/test/java/org/dependencytrack/tasks/BomUploadProcessingTaskTest.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@
4444
import org.dependencytrack.notification.NotificationScope;
4545
import org.dependencytrack.notification.vo.BomProcessingFailed;
4646
import org.dependencytrack.notification.vo.NewVulnerabilityIdentified;
47-
import org.dependencytrack.persistence.DefaultObjectGenerator;
4847
import org.junit.After;
49-
import org.junit.AfterClass;
5048
import org.junit.Before;
51-
import org.junit.BeforeClass;
5249
import org.junit.Test;
5350

5451
import java.nio.charset.StandardCharsets;
@@ -78,8 +75,6 @@ public void inform(final Notification notification) {
7875

7976
@Before
8077
public void setUp() {
81-
EventService.getInstance().subscribe(VulnerabilityAnalysisEvent.class, VulnerabilityAnalysisTask.class);
82-
EventService.getInstance().subscribe(NewVulnerableDependencyAnalysisEvent.class, NewVulnerableDependencyAnalysisTask.class);
8378
NotificationService.getInstance().subscribe(new Subscription(NotificationSubscriber.class));
8479

8580
// Enable processing of CycloneDX BOMs
@@ -106,6 +101,9 @@ public void tearDown() {
106101

107102
@Test
108103
public void informTest() throws Exception {
104+
EventService.getInstance().subscribe(VulnerabilityAnalysisEvent.class, VulnerabilityAnalysisTask.class);
105+
EventService.getInstance().subscribe(NewVulnerableDependencyAnalysisEvent.class, NewVulnerableDependencyAnalysisTask.class);
106+
109107
Project project = qm.createProject("Acme Example", null, "1.0", null, null, null, true, false);
110108

111109
final VulnerableSoftware vs = new VulnerableSoftware();

0 commit comments

Comments
 (0)