Repository navigation
Conversation
64ff908 to
721f4f9
Compare
b6f3f91 to
081f506
Compare
a300e50 to
83a2286
Compare
|
🤔 Might have sense, however, wouldn't be easier to ignore the send? |
5a8459a to
1bc9c06
Compare
I want the send to happen, but to a different server, or a different login, or sometimes the just different target directories. |
Add a generic test-mode toggle on edi.backend so backend implementations can route exchanges through their test configuration instead of live partners. - test_mode boolean on the backend form, visible only for backend types flagged test_mode_supported (new field on edi.backend.type) - test_mode_supported related field + warning banner while active - get_conn_parameter(name, operation=None) resolves test_<name> for whitelisted params (_edi_test_conn_param_fields) at read time, to be extended by backend implementations - data/neutralize.sql enables test_mode on all backends of copied or neutralized databases so they never hit live partners Assisted-by: Devin:SWE-2 Flash Medium
Route all connection reads through edi.backend.get_conn_parameter() so test mode resolves test_* values at read time without rewriting live configuration: - whitelist storage_id + all *_dir_* params for test_ overrides - test_storage_id field for an alternate test FS storage (different host/credentials) - test_*_dir_* fields on the backend form (Test environment group) Assisted-by: Devin:SWE-2 Flash Medium
1bc9c06 to
8b4d1f2
Compare
simahawk
left a comment
There was a problem hiding this comment.
Please move it to its own module, eg: edi_storage_test_mode.
As for non prod envs override, I would recommend to use confidoo (we are moving away from server env for this). See OCA/server-env#258
| @@ -0,0 +1,2 @@ | |||
| -- Copied/neutralized databases must not talk to live partners. | |||
| UPDATE edi_backend SET test_mode = true; | |||
There was a problem hiding this comment.
I would avoid this by default, if you really need it it should be done in your own module.
There was a problem hiding this comment.
Providing a test mode and not supporting the neutralization sounds broken to me.
Note that this will have absolutely no effect in backends that don't support the test mode yet.
Hopefully that is added, because it is scary to have a test neutralized DB that can still send invoices to my customer's production system.
| output_dir_error = fields.Char( | ||
| "Output error directory", help="Path to folder for error operations" | ||
| ) | ||
| test_input_dir_pending = fields.Char( |
There was a problem hiding this comment.
I would simply assume that by convention the normal path is prefixed or suffixed by "test" and if you use a different storage, you don't care
There was a problem hiding this comment.
II may not be in control of the directory structure provided by the external system.
| def exchange_record_model(self): | ||
| return self.env["edi.exchange.record"] | ||
|
|
||
| def get_conn_parameter(self, name, operation=None): |
There was a problem hiding this comment.
this should definitely not be in core and it looks more as a task for a send handler
There was a problem hiding this comment.
An alternative would be to have backend specific neutralization scripts that overwite the production secrets with the test secrets.
I do see myself reimplementing a "get_conn_parameters" on each integration, so it would be nice to have a common method available to extend form.
But then just set another storage while you are testing. In any case what you are proposing here is going to impact ALL the exchanges. A different thing would be if you want to send to a specific storage 1 single exchange type to test. Let's take a step back: what is the flow that you have in mind and what is really missing to make it happen in a smooth way? |
|
@simahawk It could me moved to a separate module, but I believe this is a missing critical feature, it it would not be a good service to do so. Explaining. On the motivation: Proper neutralization of external connections is a basic expectation for staging/testing systems. Not supporting this is a business risk. Having the neutralization automatically enable the test system connection credentials through configuration is a quality of life improvement. On the proposed implementation: It is designed provide support for 2) while having no impact on existing backend implementations and installations.
|
|
@dreispt If we want proper neutralization, the right approach would be disable sending. It is safer because it covers all examples. Right now, this relies on an extra system to add a lot of extra configuration that users will not implement and might have no sense in a lot of cases. |
This is not the place. The framework is agnostic of where you send files to or receive from. The neutralization must be done on the storage and webservice (for WS I've just added it on v18).
That's why I suggested to use per env conf instead of handling everything on prod.
It shouldn't be part of the core because as of now is not a business risk. You can already achieve what you want today w/o further additions (or just the neutralization of the storage modules). |
|
I can agree on a test mode to be a separate module. |
Again, is not to be done here. It goes on the modules/model that you use to send to/receive from :) |
I disagree. |
|
@dreispt I'm not sure if I'm not explaining myself properly or if you should re-read what I wrote before 😅 |
|
Thank you for following up. I may have misunderstood (misled?) at what a backend is. I assumed it represented a connection to an external system, and the backend type represented the different APIs and transports. I can see that Storage delegates secrets to a separate Model, and Webservice transports use a similar pattern. |
|
Follow up: OCA/storage#696 |
Summary
Adds a Test mode toggle to EDI backends so exchanges can run against
test endpoints instead of live partners.
edi.backend.test_modeflag, shown only for backend types thatsupport it (
demo_*types by default; connectors opt in via_edi_test_mode_supported).data/neutralize.sqlenables test mode on all backends, so copieddatabases never reach live partners.
get_conn_parameter(), whichconnectors can override to return test values —
edi_storage_ocanowreads directories through it.
No behavior change for existing backends: test mode defaults to off.
Test plan
test_modeis set.