temporalio / temporalio/sdk-java

Tests not passing: TestStatsReporter Flush not flushing

Open
#2,750 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

Expected Behavior

I'd expect running ./gradlew test or build would pass on a clean main branch. That is not happening.
WorkflowFailedMetricsTests.java runs a @Before setup that contains: reporter.flush()
Some methods are experiencing failures when ran in conjunction with other tests, such as:
runtimeExceptionWorkflowFailedMetric java.lang.AssertionError: No metric 'temporal_workflow_failed [namespace=UnitTest|task_queue=WorkflowTest-runtimeExceptionWorkflowFailedMetric-b83ed43d-267b-430a-8634-4ecc35a5ceb2|workflow_type=TestWorkflow]', reported metrics: temporal_poller_start [namespace=UnitTest|task_queue=WorkflowTest-runtimeExceptionWorkflowFailedMetric-b83ed43d-267b-430a-8634-4ecc35a5ceb2|worker_type=WorkflowWorker] temporal_worker_start [namespace=UnitTest|task_queue=WorkflowTest-runtimeExceptionWorkflowFailedMetric-b83ed43d-267b-430a-8634-4ecc35a5ceb2|worker_type=WorkflowWorker] temporal_request [operation=DescribeNamespace] temporal_long_request [namespace=UnitTest|operation=GetWorkflowExecutionHistory] temporal_request [] temporal_request [operation=GetSystemInfo] temporal_request [namespace=UnitTest|operation=StartWorkflowExecution|task_queue=WorkflowTest-runtimeExceptionWorkflowFailedMetric-b83ed43d-267b-430a-8634-4ecc35a5ceb2|workflow_type=TestWorkflow] temporal_long_request [namespace=UnitTest|operation=PollWorkflowTaskQueue|task_queue=WorkflowTest-runtimeExceptionWorkflowFailedMetric-b83ed43d-267b-430a-8634-4ecc35a5ceb2|worker_type=WorkflowWorker] temporal_workflow_task_queue_poll_succeed [namespace=UnitTest|task_queue=WorkflowTest-runtimeExceptionWorkflowFailedMetric-b83ed43d-267b-430a-8634-4ecc35a5ceb2|worker_type=WorkflowWorker] at org.junit.Assert.fail(Assert.java:89) at io.temporal.common.reporter.TestStatsReporter.assertCounter(TestStatsReporter.java:53) at io.temporal.common.reporter.TestStatsReporter.assertCounter(TestStatsReporter.java:45) at io.temporal.internal.worker.WorkflowFailedMetricsTests.runtimeExceptionWorkflowFailedMetric(WorkflowFailedMetricsTests.java:164) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at io.temporal.testing.internal.SDKTestWorkflowRule$1.evaluate(SDKTestWorkflowRule.java:233) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at java.base/java.lang.Thread.run(Thread.java:1583) workflowFailureMetricBenignApplicationError java.lang.AssertionError: No metric 'temporal_workflow_failed [namespace=UnitTest|task_queue=WorkflowTest-workflowFailureMetricBenignApplicationError-20c969a7-bd07-49f5-b275-eea4eacb2533|workflow_type=ApplicationFailureWorkflow]', reported metrics: temporal_worker_start [namespace=UnitTest|task_queue=WorkflowTest-workflowFailureMetricBenignApplicationError-20c969a7-bd07-49f5-b275-eea4eacb2533|worker_type=WorkflowWorker] temporal_request [operation=DescribeNamespace] temporal_poller_start [namespace=UnitTest|task_queue=WorkflowTest-workflowFailureMetricBenignApplicationError-20c969a7-bd07-49f5-b275-eea4eacb2533|worker_type=WorkflowWorker] temporal_request [namespace=UnitTest|operation=StartWorkflowExecution|task_queue=WorkflowTest-workflowFailureMetricBenignApplicationError-20c969a7-bd07-49f5-b275-eea4eacb2533|workflow_type=ApplicationFailureWorkflow] temporal_request [operation=GetSystemInfo] temporal_long_request [namespace=UnitTest|operation=PollWorkflowTaskQueue|task_queue=WorkflowTest-workflowFailureMetricBenignApplicationError-20c969a7-bd07-49f5-b275-eea4eacb2533|worker_type=WorkflowWorker] at org.junit.Assert.fail(Assert.java:89) at io.temporal.common.reporter.TestStatsReporter.assertCounter(TestStatsReporter.java:53) at io.temporal.common.reporter.TestStatsReporter.assertCounter(TestStatsReporter.java:45) at io.temporal.internal.worker.WorkflowFailedMetricsTests.workflowFailureMetricBenignApplicationError(WorkflowFailedMetricsTests.java:204) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at io.temporal.testing.internal.SDKTestWorkflowRule$1.evaluate(SDKTestWorkflowRule.java:233) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at java.base/java.lang.Thread.run(Thread.java:1583)

Steps to Reproduce the Problem

  1. Run ./gradlew build, or ./gradlew test

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running ./gradlew test or ./gradlew build and inspect TestStatsReporter.java, especially flush() and assertCounter(), alongside WorkflowFailedMetricsTests.java. Reproduce the failures at the reported test methods and determine why reporter.flush() does not make the expected metrics available. Done means the affected tests and the clean build pass consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.