Open dhiaayachi opened 2 months ago
Unit tests should pass.
Unit tests do not pass.
v1.24.2
or release/v1.24.x
make unit-test-coverage
or go test ./service/history/workflow/...
=== Failed
=== FAIL: service/history/workflow TestMutableStateSuite/TestTotalEntitiesCount (0.00s)
2024-07-22T22:38:14.867Z info Task key range updated {"number": 1048576, "next-number": 2097152, "logging-call-at": "task_key_generator.go:177"}
controller.go:231: missing call(s) to *cluster.MockMetadata.ClusterNameForFailoverVersion(is equal to false (bool), is equal to 1234 (int64)) /home/runner/work/temporal/temporal/service/history/workflow/mutable_state_impl_test.go:1087
controller.go:231: missing call(s) to *cluster.MockMetadata.GetCurrentClusterName() /home/runner/work/temporal/temporal/service/history/workflow/mutable_state_impl_test.go:1091
controller.go:231: aborting test due to missing call(s)
=== FAIL: service/history/workflow TestMutableStateSuite (0.05s)
DONE 4541 tests, 7 skipped, 2 failures in 665.189s
make: *** [Makefile:405: unit-test-coverage] Error 1
Current runner version: '2.317.0'
Operating System
Ubuntu
[2](https://github.com/bigeyedata/temporal/actions/runs/10049193855/job/27775132542?pr=19#step:1:2)2.04.4
LTS
Runner Image
Image: ubuntu-22.04
Version: 20240714.1.0
Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20240714.1/images/ubuntu/Ubuntu2204-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20240714.1
Runner Image Provisioner
2.0.[3](https://github.com/bigeyedata/temporal/actions/runs/10049193855/job/27775132542?pr=19#step:1:3)70.1
The issue is related to the missing calls in TestMutableStateSuite
, specifically in the TestTotalEntitiesCount
test. The test expects cluster.MockMetadata
to be called in two specific ways:
*cluster.MockMetadata.ClusterNameForFailoverVersion(is equal to false (bool), is equal to 1234 (int64))
*cluster.MockMetadata.GetCurrentClusterName()
These calls are not being made, causing the test to fail.
The solution lies in ensuring that the cluster.MockMetadata
instance in the test is set up correctly and that the relevant methods are called during the test execution.
This could involve:
TestTotalEntitiesCount
test: Check the implementation and identify why the calls are missing. This might involve verifying the logic within the test and ensuring the correct mock methods are being called.cluster.MockMetadata
instance: Ensure that the cluster.MockMetadata
instance is properly initialized and configured to support the expected behavior. This might require reviewing the setup of the mock object and verifying its initialization and configuration.Please review the TestTotalEntitiesCount
test in service/history/workflow/mutable_state_impl_test.go
, focusing on the calls to cluster.MockMetadata
. Ensure that the mock object is correctly set up and that the relevant methods are being called. If necessary, add the missing calls or adjust the cluster.MockMetadata
instance to address the issue.
By verifying the calls to cluster.MockMetadata
, you can ensure the unit test correctly simulates the expected behavior and validate the logic within the test. This should resolve the failure and ensure that the unit tests pass.
Please note: This response is based on the provided context and assumes the issue is isolated to the TestTotalEntitiesCount
test and the cluster.MockMetadata
setup. Additional investigation might be needed depending on the specific implementation of the test.
Unit tests should pass
Unit tests do not pass
v1.24.2
or release/v1.24.x
make unit-test-coverage
or go test ./service/history/workflow/...
=== Failed
=== FAIL: service/history/workflow TestMutableStateSuite/TestTotalEntitiesCount (0.00s)
2024-07-22T22:38:14.867Z info Task key range updated {"number": 1048576, "next-number": 2097152, "logging-call-at": "task_key_generator.go:177"}
controller.go:231: missing call(s) to *cluster.MockMetadata.ClusterNameForFailoverVersion(is equal to false (bool), is equal to 1234 (int64)) /home/runner/work/temporal/temporal/service/history/workflow/mutable_state_impl_test.go:1087
controller.go:231: missing call(s) to *cluster.MockMetadata.GetCurrentClusterName() /home/runner/work/temporal/temporal/service/history/workflow/mutable_state_impl_test.go:1091
controller.go:231: aborting test due to missing call(s)
=== FAIL: service/history/workflow TestMutableStateSuite (0.05s)
DONE 4541 tests, 7 skipped, 2 failures in 665.189s
make: *** [Makefile:405: unit-test-coverage] Error 1
Current runner version: '2.317.0'
Operating System
Ubuntu
[2](https://github.com/bigeyedata/temporal/actions/runs/10049193855/job/27775132542?pr=19#step:1:2)2.04.4
LTS
Runner Image
Image: ubuntu-22.04
Version: 20240714.1.0
Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20240714.1/images/ubuntu/Ubuntu2204-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20240714.1
Runner Image Provisioner
2.0.[3](https://github.com/bigeyedata/temporal/actions/runs/10049193855/job/27775132542?pr=19#step:1:3)70.1
Thanks for reporting this issue.
It seems like your tests are failing because controller.go
doesn't have the expected calls for *cluster.MockMetadata.ClusterNameForFailoverVersion
and *cluster.MockMetadata.GetCurrentClusterName
.
Could you please share the code for the TestMutableStateSuite
test suite? I need the code from mutable_state_impl_test.go
to investigate the issue further.
Thanks for reporting this issue.
It seems like there's an issue with how the MockMetadata
is being used in the test. Specifically, it looks like the test is expecting calls to ClusterNameForFailoverVersion
and GetCurrentClusterName
that are not being made.
To solve this, you'll need to ensure that the mock object is correctly set up to meet the expectations of the test.
Here's how you can approach troubleshooting:
Verify Mock Expectations: Make sure the MockMetadata
object has the appropriate expectations set for the functions ClusterNameForFailoverVersion
and GetCurrentClusterName
. You'll need to use the mocking framework's APIs to define the expected calls.
Inspect the Test Code: Examine the test code closely to understand how the MockMetadata
is used and how the Workflow code interacts with it. This will help you identify any discrepancies between the mock's setup and the actual usage in the test.
Review the Workflow Code: Check the relevant portion of the Workflow code, specifically where the MockMetadata
is being used, and verify that it's being called as expected by the test.
Console Logging: Add console logging statements inside the test code and Workflow code to print the values being passed to the MockMetadata
object. This can help you understand the actual calls and identify any inconsistencies.
Minimal Reproducible Example: If possible, create a smaller, isolated test case that demonstrates the issue to make it easier to troubleshoot. This will help you focus your efforts on the core problem.
Community Forum: If you are unable to resolve the issue, consider posting on Temporal's community forum ( https://community.temporal.io/) for help from the Temporal community.
Please provide the following information so I can assist you further:
MockMetadata
setup and any related test code?Let me know if you have any further questions!
Thanks for reporting this issue. The error message indicates that the unit tests are failing because the mock metadata is not being called as expected.
Here are a few things to check:
ClusterNameForFailoverVersion
and GetCurrentClusterName
methods should be mocked with the appropriate values. If you've already checked these items and still encounter the issue, please provide more context.
Let me know if you have any other questions. I'm happy to help you resolve this issue.
Thanks for reporting this. The unit tests are failing due to the missing calls to ClusterNameForFailoverVersion
and GetCurrentClusterName
methods of the mock metadata in mutable_state_impl_test.go
. This indicates that the logic is expecting these methods to be called, but the mock is not fulfilling these expectations.
To resolve this, you can add the missing calls to the mock metadata in the test. For example:
// This is the test method, this is just an example, make sure you adjust it to fit the logic of the original method
func TestTotalEntitiesCount(t *testing.T) {
env := NewTestWorkflowEnvironment()
// Make sure the test environment is stopped after the test is completed
defer env.Close()
ms := NewMutableState(env.GetMockBackend(), env.GetClient(), env.GetLogger(), env.GetMetricsScope(), 10, time.Minute, time.Minute, time.Second, 1, 1)
// ... Your setup for the test goes here
env.GetMockBackend().Metadata.On("ClusterNameForFailoverVersion", mock.Anything).Return("your-cluster-name", nil)
env.GetMockBackend().Metadata.On("GetCurrentClusterName").Return("your-cluster-name")
// ... The rest of your test goes here
}
You can also check the Temporal documentation on testing for more information on mocking and testing.
Thanks for reporting the issue. I see the unit tests are failing on v1.24.2
. The failures are happening due to missing mock calls in the TestMutableStateSuite
tests:
*cluster.MockMetadata.ClusterNameForFailoverVersion
*cluster.MockMetadata.GetCurrentClusterName
To fix the issue, you can add these mock calls to the tests to ensure that the mock functions are called as expected.
Please refer to the documentation for more information: Temporal CLI workflow command reference.
Thanks for reporting this issue. The error seems to be caused by missing mock calls for cluster.MockMetadata.ClusterNameForFailoverVersion()
and cluster.MockMetadata.GetCurrentClusterName()
. Could you confirm that the mock implementation of cluster.MockMetadata
is correct and if these calls are expected?
Thanks for reporting this issue.
Please confirm the following:
Once you have provided these details, I will be able to help you find a solution.
Thank you for reporting this issue. Could you please share the service/history/workflow/mutable_state_impl_test.go
file so I can help you troubleshoot this?
Expected Behavior
Unit tests should pass
Actual Behavior
Unit tests do not pass
Steps to Reproduce the Problem
v1.24.2
orrelease/v1.24.x
make unit-test-coverage
orgo test ./service/history/workflow/...
Specifications