Skip to content
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

ModuleContext should be immutable to avoid threading issues #1398

Closed
matt2e opened this issue May 3, 2024 · 0 comments · Fixed by #1400
Closed

ModuleContext should be immutable to avoid threading issues #1398

matt2e opened this issue May 3, 2024 · 0 comments · Fixed by #1400
Assignees

Comments

@matt2e
Copy link
Collaborator

matt2e commented May 3, 2024

No description provided.

@matt2e matt2e self-assigned this May 3, 2024
@matt2e matt2e mentioned this issue May 3, 2024
10 tasks
@alecthomas alecthomas mentioned this issue May 3, 2024
matt2e added a commit that referenced this issue May 3, 2024
fixes: #1398
Now a ModuleContext is built using the following functions:
- `New(moduleName)`
- `func (m ModuleContext) Update(configs map[string][]byte, secrets
map[string][]byte, databases map[string]Database) ModuleContext`
- `func (m ModuleContext) UpdateForTesting(mockVerbs
map[schema.RefKey]MockVerb, allowDirectVerbBehavior bool) ModuleContext`
- `func (m ModuleContext) UpdateFromEnvironment(ctx context.Context)
(ModuleContext, error)`
   - (this one will still be split up and changed in an upcoming PR)

`ftltest` now uses `ftltest.Options` as an opaque way of building up
state to then create a ModuleContext with the above functions. Before we
were passing around `context.Context` and mutating the ModuleContext
directly each anything was changed.

And now everything uses the ModuleContext struct directly, rather than
with a pointer.

This change won't have any effect on how users write their module unit
tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant