()
| 830 | } |
| 831 | |
| 832 | func (s *WatcherTestSuite) TestWithEntityFilterOrg() { |
| 833 | producer, err := watcher.RegisterProducer(s.ctx, "test-producer") |
| 834 | s.Require().NoError(err) |
| 835 | s.Require().NotNil(producer) |
| 836 | |
| 837 | entity := params.ForgeEntity{ |
| 838 | EntityType: params.ForgeEntityTypeOrganization, |
| 839 | Name: "test", |
| 840 | ID: "test", |
| 841 | } |
| 842 | |
| 843 | consumer, err := watcher.RegisterConsumer( |
| 844 | s.ctx, "test-consumer", |
| 845 | watcher.WithEntityFilter(entity), |
| 846 | ) |
| 847 | s.Require().NoError(err) |
| 848 | s.Require().NotNil(consumer) |
| 849 | consumeEvents(consumer) |
| 850 | |
| 851 | payload := common.ChangePayload{ |
| 852 | EntityType: common.OrganizationEntityType, |
| 853 | Operation: common.UpdateOperation, |
| 854 | Payload: params.Organization{ |
| 855 | ID: "test", |
| 856 | Name: "test", |
| 857 | }, |
| 858 | } |
| 859 | err = producer.Notify(payload) |
| 860 | s.Require().NoError(err) |
| 861 | |
| 862 | receivedPayload := waitForPayload(consumer.Watch(), 100*time.Millisecond) |
| 863 | s.Require().NotNil(receivedPayload) |
| 864 | s.Require().Equal(payload, *receivedPayload) |
| 865 | |
| 866 | payload = common.ChangePayload{ |
| 867 | EntityType: common.OrganizationEntityType, |
| 868 | Operation: common.UpdateOperation, |
| 869 | Payload: params.Organization{ |
| 870 | ID: "test2", |
| 871 | Name: "test", |
| 872 | }, |
| 873 | } |
| 874 | |
| 875 | err = producer.Notify(payload) |
| 876 | s.Require().NoError(err) |
| 877 | receivedPayload = waitForPayload(consumer.Watch(), 100*time.Millisecond) |
| 878 | s.Require().Nil(receivedPayload) |
| 879 | } |
| 880 | |
| 881 | func (s *WatcherTestSuite) TestWithEntityFilterEnterprise() { |
| 882 | producer, err := watcher.RegisterProducer(s.ctx, "test-producer") |
nothing calls this directly
no test coverage detected