Skip to content

Add event-notification feature file template#470

Merged
rartych merged 42 commits intocamaraproject:mainfrom
bigludo7:main
Jun 16, 2025
Merged

Add event-notification feature file template#470
rartych merged 42 commits intocamaraproject:mainfrom
bigludo7:main

Conversation

@bigludo7
Copy link
Collaborator

What type of PR is this?

  • documentation

What this PR does / why we need it:

This is a proposal of Subscription feature template.
I used the nice work done by @maxl2287 in several subscriptions API ;)

Which issue(s) this PR fixes:

Fixes #293

Does this PR introduce a breaking change?

  • Yes
  • No

Special notes for reviewers:

Changelog input

 release-note
- add a template for subscription test case.

Additional documentation

This section can be blank.

docs

@rartych
Copy link
Contributor

rartych commented May 28, 2025

Thanks @bigludo7
We have https://github.com/camaraproject/Commonalities/tree/main/artifacts/testing folder with tests templates, so we need to decide if group together all artifacts related to testing or related to Cloudevents.

The template should be updated with changes included in #464 (when it is merged)

When the request "createSubscription" is sent
Then the response code is 201
And the response header "Content-Type" is "application/json"
And the response header "x-correlator" has same value as the request header "x-correlator"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we have to mention Location header that points to created subscription?

Copy link
Contributor

@jlurien jlurien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may include some additional scenario to test the "initialEvent". e.g.

 @<xxx>_subscriptions_XX_subscription_creation_initial_event
  Scenario: Receive initial event notification on creation
    Given the API supports initial events to be sent
    And a valid subscription request body with property "$.config.initialEvent" set to true
    When the request "create<xxx>Subscription" is sent
    Then the response code is 201 or 202	
    And an event notification of the subscribed type is received on callback-url
    And notification body complies with the OAS schema at "#/components/schemas/Subscription"
```
This optional scenario may apply for some implementations

@_subscriptions_XX_subscription_creation_multievent_not_supported
Scenario: Multi event subscription not supported
Given the API provider only allows one event to be subscribed per subscription request
And a valid subscription request body
And the request body property "$.types" is set to an array of 2 valid items
When the request "createSubscription" is sent
Then the response code is 422
And the response property "$.status" is 422
And the response property "$.code" is "MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED"
And the response property "$.message" contains a user friendly text

And the response property "$.code" is "NOT_FOUND"
And the response property "$.message" contains a user friendly text

########Specific Subscription error scenarios when Device object is used ################
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have these scenarios included in dedicated artifacts we may just reference the other artifacts to not maintain equivalent scenarios in several places

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes agree with your proposal @jlurien to remove them to avoid redundancy.
Before to remove them looking for OK from other "usual suspects": @PedroDiez @rartych @patrice-conil OK for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep here these tests because the dedicated artifacts
https://github.com/camaraproject/Commonalities/blob/main/artifacts/testing/C02-phoneNumber-errors.feature
https://github.com/camaraproject/Commonalities/blob/main/artifacts/testing/C01-device-errors.feature

They refer to "$.phoneNumber" or "$.device", and in subscription APIs, they are both under "$.config.subscriptionDetail." path so somehow it may be misleading for the reader.

Would this makes sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have aligned with Jose, please forget previous comment, yes we can take out this section from this PR and manage within ongoing #479.
There is a way to make it generic enough to cover both cases of "regular" APIs and "Subscription" APIs

cc @bigludo7 @rartych @patrice-conil

Copy link
Contributor

@jlurien jlurien Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have updated #479, so now artifacts are compatible with APIs having device or phoneNumber in paths other than $.xxx

@jlurien
Copy link
Contributor

jlurien commented Jun 4, 2025

@maxl2287 You may also be interested in reviewing my comments as a common agreement here will ease porting this artifact to the APIs

bigludo7 and others added 13 commits June 5, 2025 10:25
Co-authored-by: Pedro Díez García <pedro.diezgarcia@telefonica.com>
Co-authored-by: Pedro Díez García <pedro.diezgarcia@telefonica.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Pedro Díez García <pedro.diezgarcia@telefonica.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
@jlurien
Copy link
Contributor

jlurien commented Jun 5, 2025

@bigludo7 please ask me to re-review when you think is ready

@bigludo7
Copy link
Collaborator Author

bigludo7 commented Jun 5, 2025

We may include some additional scenario to test the "initialEvent". e.g.

 @<xxx>_subscriptions_XX_subscription_creation_initial_event
  Scenario: Receive initial event notification on creation
    Given the API supports initial events to be sent
    And a valid subscription request body with property "$.config.initialEvent" set to true
    When the request "create<xxx>Subscription" is sent
    Then the response code is 201 or 202	
    And an event notification of the subscribed type is received on callback-url
    And notification body complies with the OAS schema at "#/components/schemas/Subscription"

This optional scenario may apply for some implementations


@_subscriptions_XX_subscription_creation_multievent_not_supported Scenario: Multi event subscription not supported Given the API provider only allows one event to be subscribed per subscription request And a valid subscription request body And the request body property "$.types" is set to an array of 2 valid items When the request "createSubscription" is sent Then the response code is 422 And the response property "$.status" is 422 And the response property "$.code" is "MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED" And the response property "$.message" contains a user friendly text

Thanks - I added both.
I've add one for INVALID_SINK as well (@<xxx>_subscription_33_invalid_url)

@bigludo7
Copy link
Collaborator Author

bigludo7 commented Jun 5, 2025

@rartych @jlurien @PedroDiez @patrice-conil Thanks all for your review !
I've considered all of them except 2 that need additional work

  • the one from my colleague @patrice-conil about the header location (will check with Patrice how to accommodate this one)
  • the comment about keeping the device error cases - I tend to think we can keep it for now waiting that we have a specific .feature file for device error.

Edit: Oh I misunderstood Pedro comment and we have already this feature file for device. I'm fine with Jose proposal just to avoid redundancy and regarding your comment Pedro we can add a note on this on the feature ?

Editorial changes proposed by @jlurien

Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
@rartych rartych dismissed stale reviews from PedroDiez and themself via f2cc346 June 13, 2025 15:28
Trailing spaces deleted.
In line 118: And instead of Then
@rartych
Copy link
Contributor

rartych commented Jun 13, 2025

I have commited @jlurien suggestions and then check the linter output and resolved all errors in: cbc4879

@rartych rartych requested review from PedroDiez, jlurien and rartych June 13, 2025 15:35
rartych
rartych previously approved these changes Jun 13, 2025
Copy link
Contributor

@rartych rartych left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproved

@bigludo7
Copy link
Collaborator Author

I have commited @jlurien suggestions and then check the linter output and resolved all errors in: cbc4879

Thank you @rartych !!! I was off this last Friday :)

Co-authored-by: Jose Luis Urien <jlurien@gmail.com>
jlurien
jlurien previously approved these changes Jun 16, 2025
Copy link
Contributor

@jlurien jlurien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@PedroDiez PedroDiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PedroDiez PedroDiez requested review from jlurien and rartych June 16, 2025 08:04
Copy link
Contributor

@rartych rartych left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide Test Definition template for explicit subscription API

5 participants