pozil / streaming-monitor

A Lightning app for monitoring streaming events: PushTopic, generic, platform events, CDC events and monitoring events.
Creative Commons Zero v1.0 Universal
125 stars 39 forks source link

Failing test : publishStreamingEvent_platformEvent_fails_when_eventName_is_not_platform_event #48

Closed adameldridge closed 4 months ago

adameldridge commented 4 months ago

StreamingMonitorControllerTest.publishStreamingEvent_platformEvent_fails_when_eventName_is_not_platform_event() is failing with the exception:

System.UnexpectedException: The specified sObject or list of sObjects contains objects that aren’t platform events. You can publish only platform event objects using EventBus.publish. Ensure the type of the specified sObject is a platform event

pozil commented 4 months ago

Hi @adameldridge, I don't know what's wrong on your end but the test is passing as expected (the exception is correctly handled by the try/catch block) when I run it manually in my scratch orgs and automatically in the project CI workflow.

=== Apex Code Coverage for Test Run 707DS00003HvWr3
TEST NAME                                                                                                      CLASS BEING TESTED          OUTCOME  PERCENT  MESSAGE  RUNTIME (MS)
─────────────────────────────────────────────────────────────────────────────────────────────────────────────  ──────────────────────────  ───────  ───────  ───────  ────────────
StreamingMonitorControllerTest.publishStreamingEvent_platformEvent_fails_when_eventName_is_not_platform_event  StreamingMonitorController  Pass     24%               103   

Did you change anything in the code?

adameldridge commented 4 months ago

Hi @pozil I've done a bit more investigation and it seems to fail in some orgs and not others. I've created scratch orgs using two different devhub orgs and it passes in one and fails in the other, so there might be something environmental going on.

adameldridge commented 4 months ago

Hi @pozil it looks like the tests are now failing on https://github.com/pozil/streaming-monitor/actions/runs/9610302714/job/26506528046. My suspicion is that something in Summer 24 release is causing an issue.

pozil commented 4 months ago

Thanks @adameldridge, you're right, this a Summer '24 change in the behavior of EventBus.publish when trying to publish something that is not a platform event:

I've removed the test since I can no longer test this specific scenario.

hkavli commented 1 month ago

Hi @pozil👋🏻 This issue still affect us. I downloaded the 3.14 version in my developer org (Summer '24 Patch 19.17). In Production we're on 3.13 (Summer '24 Patch 19.18). Both are Managed.

I see in AppExchange that the latest release was 05/22/2024. Are you guys bringing this change to the next release?

pozil commented 1 month ago

Hi @hkavli, I'm not sure to follow. I removed the publishStreamingEvent_platformEvent_fails_when_eventName_is_not_platform_event test to fix this issue in v3.14. Are you saying that you still have the issue in v3.14?