Skip to content

Some Formula tests are flaky #249

@ela-kotulska-frequenz

Description

@ela-kotulska-frequenz

What happened?

    async def test_3_phase_formulas(self, mocker: MockerFixture) -> None:
        """Test 3 phase formulas current formulas and their composition."""
        mockgrid = MockMicrogrid(grid_side_meter=False)
        mockgrid.add_batteries(3)
        mockgrid.add_ev_chargers(1)
        request_chan, channel_registry = await mockgrid.start(mocker)
        logical_meter = LogicalMeter(
            channel_registry,
            request_chan.new_sender(),
            microgrid.get().component_graph,
        )
        grid_current_recv = await logical_meter.grid_current()
        pool = EVChargerPool(channel_registry, request_chan.new_sender())
        ev_current_recv = await pool.total_current()
    
        engine = (grid_current_recv.clone() - ev_current_recv.clone()).build(
            "net_current"
        )
        net_current_recv = engine.new_receiver()
    
        await synchronize_receivers(
            [grid_current_recv, ev_current_recv, net_current_recv]
        )
    
        for _ in range(10):
            grid_amps = await grid_current_recv.receive()
            ev_amps = await ev_current_recv.receive()
            net_amps = await net_current_recv.receive()
    
>           assert grid_amps.value_p1 is not None and grid_amps.value_p1 > 0.0
E           assert (None is not None)
E            +  where None = Sample3Phase(timestamp=datetime.datetime(2023, 3, 10, 7, 9, 39, 78987, tzinfo=datetime.timezone.utc), value_p1=None, value_p2=None, value_p3=None).value_p1

What did you expect instead?

We should fix them

Affected version(s)

No response

Affected part(s)

Unit, integration and performance tests (part:tests)

Extra information

No response

Metadata

Metadata

Assignees

Labels

part:testsAffects the unit, integration and performance (benchmarks) testspriority:highAddress this as soon as possibletype:bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions