diff options
Diffstat (limited to 'tests/e2e/e2e_test.go')
| -rw-r--r-- | tests/e2e/e2e_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index e37810a..939d231 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -286,3 +286,26 @@ func TestMTUFragmentation(t *testing.T) { t.Errorf("expected command to pass, got: %v", err) } } + +func TestExitCodePropagation(t *testing.T) { + binaryPath, err := GetBinaryPath() + if err != nil { + t.Skipf("Skipping test: %v", err) + } + + // Run a command that exits with code 42 + cmd := exec.Command(binaryPath, "--profile", "default", "--", "sh", "-c", "exit 42") + err = cmd.Run() + if err == nil { + t.Fatalf("expected command to fail with exit status 42, but it succeeded") + } + + exitErr, ok := err.(*exec.ExitError) + if !ok { + t.Fatalf("expected error of type *exec.ExitError, got %T: %v", err, err) + } + + if exitErr.ExitCode() != 42 { + t.Errorf("expected exit code 42, got %d", exitErr.ExitCode()) + } +} |
