Skip to content

Commit f96318f

Browse files
Fix linter
1 parent 252f67d commit f96318f

File tree

4 files changed

+1
-119
lines changed

4 files changed

+1
-119
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ e2e-test:
6262
echo "E2E tests require Linux platform. Current platform: $$(uname)"; \
6363
exit 1; \
6464
fi
65-
sudo $(shell which go) test -v -race ./e2e_tests
65+
sudo $(shell which go) test -v -race ./e2e_tests -count=1
6666
@echo "✓ E2E tests passed!"
6767

6868
# Run tests with coverage (needs sudo for E2E tests)

cli/cli.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ func Run(ctx context.Context, config Config, args []string) error {
110110
// Program to run
111111
bin := args[0]
112112
args = args[1:]
113-
env := os.Environ()
114113

115114
cmd := exec.Command(bin, args...)
116115
cmd.Stdin = os.Stdin
@@ -122,20 +121,7 @@ func Run(ctx context.Context, config Config, args []string) error {
122121
return err
123122
}
124123
log.Printf("successfully run %s: %s", bin, "output")
125-
126-
return nil
127-
128-
//log.Printf("bin: %v, args: %v\n", bin, args)
129-
//log.Printf("env: %v\n", os.Environ())
130-
// syscall.Exec replaces the current process image
131-
// with the new program, so nothing after this call runs.
132-
if err := syscall.Exec(bin, args, env); err != nil {
133-
log.Printf("failed to exec child process: %v", err)
134-
return fmt.Errorf("failed to exec child process: %v", err)
135-
}
136124

137-
// This line is never reached if Exec succeeds.
138-
log.Println("done")
139125
return nil
140126
}
141127

e2e_tests/boundary_integration_test.go

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -38,70 +38,6 @@ func findProjectRoot(t *testing.T) string {
3838
}
3939
}
4040

41-
// getNamespaceName gets the single network namespace name
42-
// Fails if there are 0 or multiple namespaces
43-
func getNamespaceName(t *testing.T) string {
44-
cmd := exec.Command("ip", "netns", "list")
45-
output, err := cmd.Output()
46-
require.NoError(t, err, "Failed to list network namespaces")
47-
48-
lines := strings.Split(string(output), "\n")
49-
var namespaces []string
50-
51-
for _, line := range lines {
52-
line = strings.TrimSpace(line)
53-
if line != "" {
54-
// Extract namespace name (first field)
55-
parts := strings.Fields(line)
56-
if len(parts) > 0 {
57-
namespaces = append(namespaces, parts[0])
58-
}
59-
}
60-
}
61-
62-
require.Len(t, namespaces, 1, "Expected exactly one network namespace, found %d: %v", len(namespaces), namespaces)
63-
return namespaces[0]
64-
}
65-
66-
//func getChildProcessPID(t *testing.T) int {
67-
// // Option 1: Look for processes with CHILD=true
68-
// cmd := exec.Command("pgrep", "-f", "CHILD=true")
69-
// output, err := cmd.CombinedOutput()
70-
// require.NoError(t, err, "output: %v", output)
71-
//
72-
// pidStr := strings.TrimSpace(string(output))
73-
// pid, err := strconv.Atoi(pidStr)
74-
// require.NoError(t, err)
75-
// return pid
76-
//
77-
// // Option 2: Use the boundary process's child PID
78-
// // This would require modifying boundary to expose the child PID
79-
//}
80-
81-
//func getBoundaryProcessPID(t *testing.T) int {
82-
// cmd := exec.Command("pgrep", "-f", "boundary-test")
83-
// output, err := cmd.Output()
84-
// require.NoError(t, err)
85-
//
86-
// pidStr := strings.TrimSpace(string(output))
87-
// pid, err := strconv.Atoi(pidStr)
88-
// require.NoError(t, err)
89-
// return pid
90-
//}
91-
//
92-
//func getChildProcessPID(t *testing.T) int {
93-
// boundaryPID := getBoundaryProcessPID(t)
94-
//
95-
// cmd := exec.Command("pgrep", "-P", fmt.Sprintf("%d", boundaryPID))
96-
// output, err := cmd.Output()
97-
// require.NoError(t, err)
98-
//
99-
// pidStr := strings.TrimSpace(string(output))
100-
// pid, err := strconv.Atoi(pidStr)
101-
// require.NoError(t, err)
102-
// return pid
103-
//}
104-
10541
func getChildProcessPID(t *testing.T) int {
10642
cmd := exec.Command("pgrep", "-f", "boundary-test", "-n")
10743
output, err := cmd.Output()

jail/linux.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -248,46 +248,6 @@ func (l *LinuxJail) Close() error {
248248
return nil
249249
}
250250

251-
// createNamespace creates a new network namespace
252-
func (l *LinuxJail) createNamespace() error {
253-
cmd := exec.Command("ip", "netns", "add", l.namespace)
254-
err := cmd.Run()
255-
if err != nil {
256-
return fmt.Errorf("failed to create namespace: %v", err)
257-
}
258-
return nil
259-
}
260-
261-
// setupDNS configures DNS resolution for the namespace
262-
// This ensures reliable DNS resolution by using public DNS servers
263-
// instead of relying on the host's potentially complex DNS configuration
264-
func (l *LinuxJail) setupDNS() error {
265-
// Always create namespace-specific resolv.conf with reliable public DNS servers
266-
// This avoids issues with systemd-resolved, Docker DNS, and other complex setups
267-
netnsEtc := fmt.Sprintf("/etc/netns/%s", l.namespace)
268-
err := os.MkdirAll(netnsEtc, 0755)
269-
if err != nil {
270-
return fmt.Errorf("failed to create /etc/netns directory: %v", err)
271-
}
272-
273-
// Write custom resolv.conf with multiple reliable public DNS servers
274-
resolvConfPath := fmt.Sprintf("%s/resolv.conf", netnsEtc)
275-
dnsConfig := `# Custom DNS for network namespace
276-
nameserver 8.8.8.8
277-
nameserver 8.8.4.4
278-
nameserver 1.1.1.1
279-
nameserver 9.9.9.9
280-
options timeout:2 attempts:2
281-
`
282-
err = os.WriteFile(resolvConfPath, []byte(dnsConfig), 0644)
283-
if err != nil {
284-
return fmt.Errorf("failed to write namespace-specific resolv.conf: %v", err)
285-
}
286-
287-
l.logger.Debug("DNS setup completed")
288-
return nil
289-
}
290-
291251
// setupIptables configures iptables rules for comprehensive TCP traffic interception
292252
func (l *LinuxJail) configureIptables() error {
293253
// Enable IP forwarding

0 commit comments

Comments
 (0)