-
Notifications
You must be signed in to change notification settings - Fork 750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add charging_state to VehicleSummary #3471
Add charging_state to VehicleSummary #3471
Conversation
The problem appears to be because we receive a extra pubsub vehicle summary message that we weren't expecting. But my code changes the code that receives the pubsub message, it shouldn't mean that there are additional pubsub messages being set. Still puzzled. |
3618963
to
6b2f74a
Compare
Does appear to be some intermittent test failures still. Don't think that explains why this is failing though. (currently this is succeeding because I commented out out of the lines). |
6b2f74a
to
21a5f95
Compare
Cool, I think I broke lots of tests :-) It is acting like there is some code somewhere that means the pubsub message will not get sent if it was the same value as the last message. When I set the field to a constant, this means all tests pass (not counting intermittent faults). But when I set the field to a random value, I get failures everywhere, because the summary keeps changing every time. The only problem is I cannot find any code that dos this comparison. I think for tests we are using our I don't see anything anywhere for dropping duplicate messages though. |
Sorry, I am an idiot, code is in def handle_call({:broadcast, _, _, _} = event, _from, %State{last_event: event} = state) do
{:reply, :ok, state}
end
def handle_call({:broadcast, _, _, _} = event, _from, %State{pid: pid} = state) do
send(pid, {:pubsub, event})
{:reply, :ok, %State{state | last_event: event}}
end When we receive and event we save it to last_event. Then if the next event matches, we ignore it. This only happens during tests. Question is how do we fix this? If I just added extra |
21a5f95
to
c8f4c14
Compare
That error I just got looks kind of bad:
Huh? Source: https://github.com/teslamate-org/teslamate/actions/runs/6936413423/job/18868513844 |
c8f4c14
to
2021705
Compare
OK, tests pass, but not convinced this is a good solution... |
Great find, thanks for the in-depth research! |
Would this be considered acceptable as is? Not really sure how to make the tests more robust without making them more complicated. I think they key issue is that these tests only want changes where the I guess we could change the pubsub mock, but that seems yuck. We might want to write a test that tests other values in the future. We could also change the |
I completely agree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty.
* Add charging_state to VehicleSummary Fixes: #3078 * WIP
Fixes: #3078
Was reverted in #3464, sorry, not sure what went wrong.
If there is a test case that needs updating, can somebody please point me to it?