Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-adapter-testsuite
Commits
3a5b94e1
Commit
3a5b94e1
authored
2 years ago
by
Dan Jones
Browse files
Options
Download
Plain Diff
Merge branch '9-error-handling-on-send' into 'dev'
Resolve "Error handling on send" Closes
#9
See merge request
!3
parents
2a22ae98
09029c59
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
142 additions
and
7 deletions
+142
-7
copy_tests.py
copy_tests.py
+2
-1
features/adapter_broadcast.feature
features/adapter_broadcast.feature
+46
-2
features/adapter_poll.feature
features/adapter_poll.feature
+46
-1
features/adapter_publish.feature
features/adapter_publish.feature
+46
-1
fixtures/config-invalid.json
fixtures/config-invalid.json
+1
-1
fixtures/config-valid.json
fixtures/config-valid.json
+1
-1
No files found.
copy_tests.py
View file @
3a5b94e1
import
os
import
os
from
shutil
import
copytree
from
shutil
import
copytree
,
rmtree
import
site
import
site
def
copy_directory
(
src
,
dest
,
directory
):
def
copy_directory
(
src
,
dest
,
directory
):
rmtree
(
os
.
path
.
join
(
dest
,
directory
))
copytree
(
os
.
path
.
join
(
src
,
directory
),
os
.
path
.
join
(
dest
,
directory
))
copytree
(
os
.
path
.
join
(
src
,
directory
),
os
.
path
.
join
(
dest
,
directory
))
...
...
This diff is collapsed.
Click to expand it.
features/adapter_broadcast.feature
View file @
3a5b94e1
...
@@ -13,6 +13,50 @@ Feature: Can the adapter broadcast messages?
...
@@ -13,6 +13,50 @@ Feature: Can the adapter broadcast messages?
Given
valid config
Given
valid config
When
the adapter instance is created
When
the adapter instance is created
When
the auth method is called
When
the auth method is called
When
a mock notify API response is configured to return a
n
error
When
a mock notify API response is configured to return a
403
error
When
the broadcast method is called
When
the broadcast method is called
Then
an error response is returned with status 403
Then
an error response is returned with status 403
\ No newline at end of file
Scenario
:
On 403 the message is retried once with new credentials
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock notify API response is configured to return a 403 error
When
the broadcast method is called
Then
an error response is returned with status 403
Then
the credentials are deleted
Then
the broadcast method was called with is_retry on
Then
the total number of calls to
"broadcast"
was 2
Then
the total number of
"GET"
requests to
"/token"
was 2
Scenario
:
On a retried 403 the message is not retried again
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock notify API response is configured to return a 403 error
When
the broadcast method is called with is_retry on
Then
an error response is returned with status 403
Then
the credentials are deleted
Then
the total number of calls to
"broadcast"
was 1
Scenario
:
On 503 the message is retried once with the same credentials
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock notify API response is configured to return a 503 error
When
the broadcast method is called
Then
an error response is returned with status 503
Then
the credentials are not deleted
Then
the broadcast method was called with is_retry on
Then
the total number of calls to
"broadcast"
was 2
Then
the total number of
"GET"
requests to
"/token"
was 1
Scenario
:
On a retried 503 the message is not retried again
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock notify API response is configured to return a 503 error
When
the broadcast method is called with is_retry on
Then
an error response is returned with status 503
Then
the credentials are not deleted
Then
the total number of calls to
"broadcast"
was 1
This diff is collapsed.
Click to expand it.
features/adapter_poll.feature
View file @
3a5b94e1
...
@@ -37,6 +37,51 @@ Feature: Can the adapter receive messages?
...
@@ -37,6 +37,51 @@ Feature: Can the adapter receive messages?
Given
valid config
Given
valid config
When
the adapter instance is created
When
the adapter instance is created
When
the auth method is called
When
the auth method is called
When
a mock receive API response is configured to return a
n
error
When
a mock receive API response is configured to return a
403
error
When
the poll method is called
When
the poll method is called
Then
an error response is returned with status 403
Then
an error response is returned with status 403
Scenario
:
On 403 the message is retried once with new credentials
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return a 403 error
When
the poll method is called
Then
an error response is returned with status 403
Then
the credentials are deleted
Then
the poll method was called with is_retry on
Then
the total number of calls to
"poll"
was 2
Then
the total number of
"GET"
requests to
"/token"
was 2
Scenario
:
On a retried 403 the message is not retried again
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return a 403 error
When
the poll method is called with is_retry on
Then
an error response is returned with status 403
Then
the credentials are deleted
Then
the total number of calls to
"poll"
was 1
Scenario
:
On 503 the message is retried once with the same credentials
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return a 503 error
When
the poll method is called
Then
an error response is returned with status 503
Then
the credentials are not deleted
Then
the poll method was called with is_retry on
Then
the total number of calls to
"poll"
was 2
Then
the total number of
"GET"
requests to
"/token"
was 1
Scenario
:
On a retried 503 the message is not retried again
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return a 503 error
When
the poll method is called with is_retry on
Then
an error response is returned with status 503
Then
the credentials are not deleted
Then
the total number of calls to
"poll"
was 1
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/adapter_publish.feature
View file @
3a5b94e1
...
@@ -13,6 +13,51 @@ Feature: Can the adapter publish messages?
...
@@ -13,6 +13,51 @@ Feature: Can the adapter publish messages?
Given
valid config
Given
valid config
When
the adapter instance is created
When
the adapter instance is created
When
the auth method is called
When
the auth method is called
When
a mock send API response is configured to return a
n
error
When
a mock send API response is configured to return a
403
error
When
the publish method is called
When
the publish method is called
Then
an error response is returned with status 403
Then
an error response is returned with status 403
Scenario
:
On 403 the message is retried once with new credentials
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock send API response is configured to return a 403 error
When
the publish method is called
Then
an error response is returned with status 403
Then
the credentials are deleted
Then
the publish method was called with is_retry on
Then
the total number of calls to
"publish"
was 2
Then
the total number of
"GET"
requests to
"/token"
was 2
Scenario
:
On a retried 403 the message is not retried again
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock send API response is configured to return a 403 error
When
the publish method is called with is_retry on
Then
an error response is returned with status 403
Then
the credentials are deleted
Then
the total number of calls to
"publish"
was 1
Scenario
:
On 503 the message is retried once with the same credentials
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock send API response is configured to return a 503 error
When
the publish method is called
Then
an error response is returned with status 503
Then
the credentials are not deleted
Then
the publish method was called with is_retry on
Then
the total number of calls to
"publish"
was 2
Then
the total number of
"GET"
requests to
"/token"
was 1
Scenario
:
On a retried 503 the message is not retried again
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock send API response is configured to return a 503 error
When
the publish method is called with is_retry on
Then
an error response is returned with status 503
Then
the credentials are not deleted
Then
the total number of calls to
"publish"
was 1
\ No newline at end of file
This diff is collapsed.
Click to expand it.
fixtures/config-invalid.json
View file @
3a5b94e1
{
{
"api"
:
"https://example.backbone.
com
/api"
,
"api"
:
"https://example.backbone.
fake
/api"
,
"client_id"
:
"invalid-client-id"
,
"client_id"
:
"invalid-client-id"
,
"client_name"
:
"InvalidClientName"
,
"client_name"
:
"InvalidClientName"
,
"subscription"
:
"dot.delimited.topic.subscription.#"
,
"subscription"
:
"dot.delimited.topic.subscription.#"
,
...
...
This diff is collapsed.
Click to expand it.
fixtures/config-valid.json
View file @
3a5b94e1
{
{
"api"
:
"https://example.backbone.
com
/api"
,
"api"
:
"https://example.backbone.
fake
/api"
,
"client_id"
:
"unique-client-id"
,
"client_id"
:
"unique-client-id"
,
"client_name"
:
"UniqueClientName"
,
"client_name"
:
"UniqueClientName"
,
"subscription"
:
"dot.delimited.topic.subscription.#"
,
"subscription"
:
"dot.delimited.topic.subscription.#"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment