MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / TestBasicConnectivity

Function TestBasicConnectivity

test/e2e/basic_test.go:14–59  ·  view source on GitHub ↗

TestBasicConnectivity tests that the proxy can be deployed and passes basic traffic

(t *testing.T)

Source from the content-addressed store, hash-verified

12
13// TestBasicConnectivity tests that the proxy can be deployed and passes basic traffic
14func TestBasicConnectivity(t *testing.T) {
15 if testing.Short() {
16 t.Skip("Skipping e2e test in short mode")
17 }
18
19 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
20 defer cancel()
21
22 // Step 1: Build lambda-nat-proxy
23 t.Log("Building lambda-nat-proxy...")
24 if err := buildLambdaProxy(); err != nil {
25 t.Fatalf("Failed to build lambda-nat-proxy: %v", err)
26 }
27
28 // Step 2: Deploy infrastructure
29 t.Log("Deploying infrastructure...")
30 if err := deployInfrastructure(); err != nil {
31 t.Fatalf("Failed to deploy infrastructure: %v", err)
32 }
33
34 // Step 3: Start proxy
35 t.Log("Starting lambda-nat-proxy...")
36 proxyCmd, err := startLambdaProxy(ctx)
37 if err != nil {
38 t.Fatalf("Failed to start lambda-nat-proxy: %v", err)
39 }
40 defer func() {
41 if proxyCmd.Process != nil {
42 proxyCmd.Process.Kill()
43 }
44 }()
45
46 // Step 4: Wait for proxy to be ready
47 t.Log("Waiting for proxy to be ready...")
48 if err := waitForSOCKS5(ctx, 8080, 2*time.Minute); err != nil {
49 t.Fatalf("Proxy failed to start: %v", err)
50 }
51
52 // Step 5: Test basic HTTP traffic through proxy
53 t.Log("Testing HTTP traffic through proxy...")
54 if err := testHTTPTraffic(); err != nil {
55 t.Fatalf("HTTP traffic test failed: %v", err)
56 }
57
58 t.Log("✅ Basic connectivity test passed!")
59}
60
61// buildLambdaProxy builds the lambda-nat-proxy binary
62func buildLambdaProxy() error {

Callers

nothing calls this directly

Calls 5

deployInfrastructureFunction · 0.85
startLambdaProxyFunction · 0.85
waitForSOCKS5Function · 0.85
testHTTPTrafficFunction · 0.85
buildLambdaProxyFunction · 0.70

Tested by

no test coverage detected