diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-27 09:18:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-27 09:18:52 +0300 |
| commit | 47d69cb998a447eea662ad1075f9d002dd875443 (patch) | |
| tree | 1fa586fc4f7e5fae2ce9badfa05679c0fee9dcb3 /integrationtests | |
| parent | 626ff3ae7d43cfc2ec3f2554d340b40f4a5c0586 (diff) | |
Add context.Context to I/O-bound public APIs (generator.Run, processor.Run, atom.Generate, syncOutput)
- generator.Run(ctx, cfg) – ctx passed through to atom.Generate
- processor.Run(ctx, cfg) – signature updated for cancellation propagation
- atom.Generate(ctx, posts, cfg) – accepts ctx for future cancellation
- syncOutput(ctx, cfg) – rsync subprocesses now use exec.CommandContext
- Updated all call sites in tests, cmd/snonux/main.go, and integration tests
- All call sites pass context.Background() / context.TODO()
All tests pass: go test ./...
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/integration_test.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/integrationtests/integration_test.go b/integrationtests/integration_test.go index 9beaf29..e3737f4 100644 --- a/integrationtests/integration_test.go +++ b/integrationtests/integration_test.go @@ -4,6 +4,7 @@ package integrationtests import ( + "context" "encoding/json" "encoding/xml" "fmt" @@ -23,6 +24,8 @@ import ( "codeberg.org/snonux/snonux/internal/processor" ) +var ctx = context.Background() //nolint:gochecknoglobals // test-only top-level helper used by every test in the file + // runPipeline executes both pipeline stages and returns the config used. func runPipeline(t *testing.T, inputDir, outputDir string) *config.Config { t.Helper() @@ -34,12 +37,12 @@ func runPipeline(t *testing.T, inputDir, outputDir string) *config.Config { Theme: "neon", } - _, err := processor.Run(cfg) + _, err := processor.Run(ctx, cfg) if err != nil { t.Fatalf("processor.Run: %v", err) } - if err := generator.Run(cfg); err != nil { + if err := generator.Run(ctx, cfg); err != nil { t.Fatalf("generator.Run: %v", err) } @@ -427,10 +430,10 @@ func TestThemeSelection(t *testing.T) { Theme: theme, } - if _, err := processor.Run(cfg); err != nil { + if _, err := processor.Run(ctx, cfg); err != nil { t.Fatalf("processor.Run: %v", err) } - if err := generator.Run(cfg); err != nil { + if err := generator.Run(ctx, cfg); err != nil { t.Fatalf("generator.Run for theme %q: %v", theme, err) } |
