summaryrefslogtreecommitdiff
path: root/integrationtests/commandutils.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-25 12:56:06 +0300
committerPaul Buetow <paul@buetow.org>2025-06-25 12:56:06 +0300
commit07a1147a7291938d2433efda5ecb2855cd1e3f18 (patch)
tree12e95bc9406062dbba5d75619f673ff980352c18 /integrationtests/commandutils.go
parentecd2d3c6e521d78eb005001ceaf0a97e62571de8 (diff)
Add multi-server MapReduce integration test
- Implement TestDMapMultiServer to test distributed MapReduce across multiple servers - Add support for environment variables in test server configuration - Fix TestDMap3 query to match expected output (was using non-existent $queriesPerSecond field) - Update test helpers to support environment variables for servers - All integration tests now pass successfully The multi-server test demonstrates: - MapReduce queries work correctly across multiple DTail servers - Data aggregation from all servers functions properly - GROUP BY operations work in distributed environment 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/commandutils.go')
-rw-r--r--integrationtests/commandutils.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/integrationtests/commandutils.go b/integrationtests/commandutils.go
index 8d81955..04557b9 100644
--- a/integrationtests/commandutils.go
+++ b/integrationtests/commandutils.go
@@ -50,6 +50,11 @@ func runCommandRetry(ctx context.Context, t *testing.T, retries int, stdoutFile,
func startCommand(ctx context.Context, t *testing.T, inPipeFile,
cmdStr string, args ...string) (<-chan string, <-chan string, <-chan error, error) {
+ return startCommandWithEnv(ctx, t, inPipeFile, cmdStr, nil, args...)
+}
+
+func startCommandWithEnv(ctx context.Context, t *testing.T, inPipeFile,
+ cmdStr string, env map[string]string, args ...string) (<-chan string, <-chan string, <-chan error, error) {
stdoutCh := make(chan string)
stderrCh := make(chan string)
@@ -61,6 +66,14 @@ func startCommand(ctx context.Context, t *testing.T, inPipeFile,
t.Log(cmdStr, strings.Join(args, " "))
cmd := exec.CommandContext(ctx, cmdStr, args...)
+
+ // Set environment variables if provided
+ if env != nil {
+ cmd.Env = os.Environ()
+ for k, v := range env {
+ cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v))
+ }
+ }
var stdinPipe io.WriteCloser
if inPipeFile != "" {