-
Notifications
You must be signed in to change notification settings - Fork 13
Driver NotificationFilter config #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thelonelyvulpes
merged 82 commits into
neo4j-drivers:5.0
from
thelonelyvulpes:feature/notifications
Mar 16, 2023
Merged
Changes from 79 commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
de8a76f
basic setup.
thelonelyvulpes 6338f05
undo commithook change
thelonelyvulpes 8cddfa2
full suite for driver config, undo validation for mapping
thelonelyvulpes aec9272
driver feature
thelonelyvulpes fd21236
add multi-filter config
thelonelyvulpes e463879
formatting for picky-parens
thelonelyvulpes 2c13c5d
session configs
thelonelyvulpes b86aabc
move
thelonelyvulpes 7b2afbe
dedupes
thelonelyvulpes d3e281e
rename to make it look nicer
thelonelyvulpes de188d5
mapping tests
thelonelyvulpes 2d13713
add tx func test
thelonelyvulpes e157f61
Update nutkit/protocol/feature.py
thelonelyvulpes f7e8e77
always serialize notification filters
thelonelyvulpes db71062
Merge remote-tracking branch 'origin/feature/notifications' into feat…
thelonelyvulpes 129eaf6
Feature:API:Driver:NotificationFilters
thelonelyvulpes 52e8173
Stubscript: add bolt alias 5 == 5.0
robsdedude 002028c
Update tests/stub/notification_filters/notification_filters_base.py
thelonelyvulpes 0e251e7
Don't assert notifications order
robsdedude 478a0d2
Replace some super calls
robsdedude a3c1e32
New `HELLO` message structure in Bolt 5.1
robsdedude 32bbc47
Add tests for new `HELLO` structure in BOLT 5.1
robsdedude bb996b2
update notification tests
thelonelyvulpes 0ff89ee
Merge remote-tracking branch 'origin/feature/notifications' into feat…
thelonelyvulpes 50bbbce
rotate auth
thelonelyvulpes c7cd6e5
updated to specification
thelonelyvulpes 2b020c7
remove order independent check from script as it is nonsensical.
thelonelyvulpes 0755d0e
Don't add null notification filters because it can break some json de…
thelonelyvulpes efad9e3
HELLO: flip auth ane extra dict in version tests
robsdedude 28ac8d6
Adjust notifications default values and combinations
robsdedude f9d822f
update test_full_notifications
thelonelyvulpes 36077b9
support discard on notification tests
thelonelyvulpes 9d12627
remove redundant pull
thelonelyvulpes 1796354
remove specific pull size
thelonelyvulpes 60a38ee
fix.
thelonelyvulpes 7cfadbf
WIP todo: test renewable_auth
robsdedude d95e207
WIP: renewable auth token protocol messages
robsdedude 4d3178d
WIP: Re-auth testing timeout
bigmontz 79045be
Add tests for refreshing auth info on errors.
robsdedude e251d2a
Add docstrings for new protocol messages
robsdedude cdb32d1
Test LOGOFF/LOGON pipelining
robsdedude 52a294e
Fix Bolt 5.1 auth scheme tests
robsdedude 0ab9bc6
Fix auto lines that should be client lines
robsdedude a24e928
Merge branch '5.0' into re-auth
robsdedude 93ba0dd
Merge branch '5.0' into feature/notifications
thelonelyvulpes 2f25142
update testkit protocol objects for min severity & disabled categories
thelonelyvulpes e883262
Add tests for supports_session_auth and verify_authentication
robsdedude 4544a6c
Merge branch '5.0' into re-auth
robsdedude 1088d40
config
thelonelyvulpes 5e08911
Merge branch 'feature/notifications' into notifications-two
thelonelyvulpes b20c66e
some python
thelonelyvulpes c1655cc
Fix driver creation
bigmontz 74ca4d7
Add javascript to the exception list
bigmontz 02e83e9
notifications!
thelonelyvulpes 72e70cb
Merge branch 're-auth' into feature/notifications
thelonelyvulpes 865bb32
add some more optimization checks
thelonelyvulpes 2ca41c9
remove redundant test, as it is defined in the base configs
thelonelyvulpes b6b764d
WIP: test backwards compatibility
robsdedude 711ef2a
Stub server: conditional blocks and python lines
robsdedude 6626c23
Update verifyAuthentication tests
robsdedude 6934a01
Document stubscript
robsdedude 84db82e
Fix types.Feature.OPT_MINIMAL_RESETS assertion
robsdedude d75a7a9
Move routing from LOGON to HELLO in kerberos test
RichardIrons-neo4j 76d8786
out of scope optimization
thelonelyvulpes c349e71
re-auth: adopt auth token provider API
robsdedude 6e37294
Add missing feature guard
robsdedude ad56dba
Add error code for Java driver
robsdedude 4f8fa2e
Allow optional routing to be `null`
robsdedude 31f0c3f
Put user switching polyfill on hold
robsdedude 23a027c
Put auth token manager behind feature flag
robsdedude 0b0ee94
Improve Stubscript docs
robsdedude 5d39f52
Add tests for retryable token expired error
robsdedude 5f3b07f
Add basic Bolt 5.1 tests
robsdedude f7178b7
Merge branch 're-auth' into feature/notifications
thelonelyvulpes b9b21c0
add test empty array
thelonelyvulpes bafa3ef
Remove all re-auth tests; leave only basic bolt 5.2 tests
robsdedude b8f0ba2
Fix summary tests to include new notification properties
robsdedude 71babad
Check disabled categories regardless of order
robsdedude 83835aa
Merge branch '5.0' into feature/notifications
thelonelyvulpes da86f42
support pre-notifications change
thelonelyvulpes 89ccf83
replace try with if has new notifications config
thelonelyvulpes 9332c18
fix for python
thelonelyvulpes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
from nutkit.frontend import Driver | ||
import nutkit.protocol as types | ||
from tests.shared import TestkitTestCase | ||
from tests.stub.shared import StubServer | ||
|
||
|
||
class NotificationsBase(TestkitTestCase): | ||
_auth = types.AuthorizationToken("basic", principal="neo4j", | ||
credentials="pass") | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self._server = StubServer(9010) | ||
self._uri = "bolt://%s" % self._server.address | ||
self._driver = None | ||
|
||
def tearDown(self): | ||
self._server.reset() | ||
if self._driver: | ||
self._driver.close() | ||
return super().tearDown() | ||
|
||
def _new_driver(self, min_sev=None, disabled_cats=None): | ||
return Driver(self._backend, self._uri, self._auth, | ||
notifications_min_severity=min_sev, | ||
notifications_disabled_categories=disabled_cats) | ||
|
||
def _run_test_get_summary(self, parameters, script_params, | ||
script="notifications_config_driver.script"): | ||
self._server.start(self.script_path(script), | ||
vars_=script_params) | ||
self._driver = self._new_driver(parameters["min_sev"], | ||
parameters["dis_cats"]) | ||
session = self._driver.session("w", database="neo4j") | ||
cursor = session.run("CREATE (:node)") | ||
result = cursor.consume() | ||
self._server.done() | ||
return result | ||
|
||
@staticmethod | ||
def configs(): | ||
return [ | ||
{ | ||
"protocol": {"min_sev": "OFF", "dis_cats": None}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": "OFF", ' | ||
} | ||
}, | ||
{ | ||
"protocol": {"min_sev": "INFORMATION", "dis_cats": None}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": ' | ||
'"INFORMATION", ' | ||
} | ||
}, | ||
{ | ||
"protocol": {"min_sev": "WARNING", "dis_cats": None}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": "WARNING", ' | ||
} | ||
}, | ||
{ | ||
"protocol": {"min_sev": None, "dis_cats": []}, | ||
"script": { | ||
"#NOTIS#": '"notifications_disabled_categories": [], ' | ||
} | ||
}, | ||
{ | ||
"protocol": { | ||
"min_sev": "INFORMATION", | ||
"dis_cats": ["UNRECOGNIZED"] | ||
}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": ' | ||
'"INFORMATION", ' | ||
'"notifications_disabled_categories": ' | ||
'["UNRECOGNIZED"], ' | ||
} | ||
}, | ||
{ | ||
"protocol": { | ||
"min_sev": "WARNING", | ||
"dis_cats": ["UNRECOGNIZED", "UNSUPPORTED"] | ||
}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": "WARNING", ' | ||
'"notifications_disabled_categories{}": ' | ||
'["UNRECOGNIZED", "UNSUPPORTED"], ' | ||
} | ||
}, | ||
{ | ||
"protocol": { | ||
"min_sev": "WARNING", | ||
"dis_cats": ["PERFORMANCE"] | ||
}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": "WARNING", ' | ||
'"notifications_disabled_categories": ' | ||
'["PERFORMANCE"], ' | ||
} | ||
}, | ||
{ | ||
"protocol": { | ||
"min_sev": "WARNING", | ||
"dis_cats": ["DEPRECATION"] | ||
}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": "WARNING", ' | ||
'"notifications_disabled_categories": ' | ||
'["DEPRECATION"], ' | ||
} | ||
}, | ||
{ | ||
"protocol": { | ||
"min_sev": "WARNING", | ||
"dis_cats": ["GENERIC"] | ||
}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": "WARNING", ' | ||
'"notifications_disabled_categories": ' | ||
'["GENERIC"], ' | ||
} | ||
}, | ||
{ | ||
"protocol": { | ||
"min_sev": "WARNING", | ||
"dis_cats": ["HINT"] | ||
}, | ||
"script": { | ||
"#NOTIS#": '"notifications_minimum_severity": "WARNING", ' | ||
'"notifications_disabled_categories": ' | ||
'["HINT"], ' | ||
} | ||
} | ||
] |
15 changes: 15 additions & 0 deletions
15
tests/stub/notifications_config/scripts/notifications_config_driver.script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
!: BOLT 5.2 | ||
|
||
A: HELLO {#NOTIS#"[user_agent]": "*", "[routing]": "*"} | ||
A: LOGON {"{}": "*"} | ||
*: RESET | ||
C: RUN "*" "*" {"[db]": "*"} | ||
S: SUCCESS {"fields": ["t"]} | ||
{{ | ||
C: PULL "*" | ||
---- | ||
C: DISCARD "*" | ||
}} | ||
S: SUCCESS {"type": "w"} | ||
*: RESET | ||
?: GOODBYE |
19 changes: 19 additions & 0 deletions
19
tests/stub/notifications_config/scripts/notifications_config_override_session_begin.script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
!: BOLT 5.2 | ||
|
||
A: HELLO {"[user_agent]": "*", "[routing]": "*", "notifications_minimum_severity": "WARNING", "notifications_disabled_categories{}":["UNSUPPORTED", "UNRECOGNIZED", "DEPRECATION", "HINT"]} | ||
A: LOGON {"{}": "*"} | ||
*: RESET | ||
C: BEGIN {#NOTIS#"[mode]": "*", "[db]": "*"} | ||
S: SUCCESS {} | ||
C: RUN "RETURN 1 as n" {} {} | ||
S: SUCCESS {"fields": ["n"]} | ||
{{ | ||
C: PULL "*" | ||
---- | ||
C: DISCARD "*" | ||
}} | ||
S: SUCCESS {"type": "r"} | ||
C: COMMIT | ||
S: SUCCESS {} | ||
*: RESET | ||
?: GOODBYE |
16 changes: 16 additions & 0 deletions
16
tests/stub/notifications_config/scripts/notifications_config_override_session_run.script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
!: BOLT 5.2 | ||
|
||
A: HELLO {"[user_agent]": "*", "[routing]": "*", "notifications_minimum_severity": "WARNING", "notifications_disabled_categories{}":["UNSUPPORTED", "UNRECOGNIZED", "DEPRECATION", "HINT"]} | ||
A: LOGON {"{}": "*"} | ||
*: RESET | ||
C: RUN "RETURN 1 as n" {} {#NOTIS#"[mode]": "*", "[db]": "*"} | ||
S: SUCCESS {"fields": ["n"]} | ||
{{ | ||
C: PULL "*" | ||
S: RECORD [1] | ||
---- | ||
C: DISCARD "*" | ||
}} | ||
S: SUCCESS {"type": "r"} | ||
*: RESET | ||
?: GOODBYE |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.