I have a Quarkus application, producing a kafka message to a topic consumed by another service, I am writing provider tests (creating a nested object with 8-9 fields with further nesting, in pact to send and to verify the contract) for that using pact. But getting below error in local and in the gitlab pipeline as well.
ClassGraph-worker-11: Retried waiting for GCLocker too often allocating 120718 words
Fine the code snippet
import au.com.dius.pact.provider.MessageAndMetadata;
import au.com.dius.pact.provider.PactVerifyProvider;
import au.com.dius.pact.provider.junit5.MessageTestTarget;
import au.com.dius.pact.provider.junit5.PactVerificationContext;
import au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider;
import au.com.dius.pact.provider.junitsupport.Provider;
import au.com.dius.pact.provider.junitsupport.loader.PactBroker;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Map;
@Provider("a-message-provider")
@PactBroker(url = "broker-url")
public class AnyMessageProviderTest {
private final ObjectMapper objectMapper = new ObjectMapper();
@BeforeAll
public static void setUp() {
System.setProperty("pact_do_not_track", "true");
System.setProperty("pact.verifier.publishResults", "true");
System.setProperty("pact.provider.version", "v1.0.0");
}
@BeforeEach
void before(PactVerificationContext context) {
context.setTarget(new MessageTestTarget());
}
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
@PactVerifyProvider("An kafka message")
MessageAndMetadata verifyOddsChange() throws IOException {
//creating Event object here with nested objects
return new MessageAndMetadata(objectMapper.writeValueAsBytes(event), Map.of("key", "3435345"));
}
}
NOTE:
quarkus version: 3.9.2,
pact library testImplementation 'au.com.dius.pact.provider:junit5:4.6.9'