Admiral-Piett / goaws

AWS (SQS/SNS) Clone for Development testing
MIT License
770 stars 145 forks source link

FilterPolicy not being included on subscription #215

Open clicktravel-antonrand opened 4 years ago

clicktravel-antonrand commented 4 years ago

Hello,

I'm currently using goaws:1.1.2 for service testing. I have a test to ensure that only events matching the filter policy end up on the relevant queue I provision, but this test fails because the FilterPolicy isn't being applied.

Given the following SNS client command (pointing to the GoAws docker instance):

    await sns.subscribe({
      Protocol,
      TopicArn,
      Endpoint,
      Attributes: {
        FilterPolicy: '{"subject":["test.TestEvent"]}',
      },
    }).promise();

I receive the following log:

goaws            | {"content":"","endpoint":"http://goaws:4100/queue/service-test-anton-event","level":"info","msg":"Creating Subscription","protocol":"sqs","time":"2020-01-31T15:38:30Z","topicArn":"arn:aws:sns:eu-west-1:000000000000:anton-event","topicName":"anton-event"}

As you can see, FilterPolicy isn't included in the log, but checking the source code - this should be included in the logs.

Can you confirm that the applied FilterPolicy is valid? If so, I think this could be a bug.