Skip to content

Commit

Permalink
DATAGO-79228: fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
mayur-solace committed Jul 22, 2024
1 parent 557f95f commit b5d2c68
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.solace.spring.cloud.stream.binder.springBootTests.multibinder;

import static org.awaitility.Awaitility.await;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import com.solace.test.integration.testcontainer.PubSubPlusContainer;
import com.solacesystems.jcsmp.JCSMPException;
import com.solacesystems.jcsmp.JCSMPFactory;
Expand All @@ -19,10 +23,6 @@
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.servlet.MockMvc;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;


/**
* Note: not using the PubSubPlusExtension as it appears to trigger after Spring Boot Application is started.
Expand Down Expand Up @@ -91,11 +91,14 @@ public void checkSolaceMetricsAreExposed(@Autowired MockMvc mvc) throws Exceptio
producer.send(JCSMPFactory.onlyInstance().createBytesXMLMessage(),
JCSMPFactory.onlyInstance().createQueue(QUEUE_NAME_PREFIX + QUEUE_NAME_1));

mvc.perform(get("/actuator/metrics"))
.andExpectAll(
await().until(() -> {
mvc.perform(get("/actuator/metrics"))
.andExpectAll(
jsonPath("names", Matchers.hasItem("solace.message.size.payload")),
jsonPath("names", Matchers.hasItem("solace.message.size.total"))
);
jsonPath("names", Matchers.hasItem("solace.message.size.total")));
return true;
}
);
}

}

0 comments on commit b5d2c68

Please sign in to comment.