TestBasicConnectivity tests that the proxy can be deployed and passes basic traffic
(t *testing.T)
| 12 | |
| 13 | // TestBasicConnectivity tests that the proxy can be deployed and passes basic traffic |
| 14 | func 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 |
| 62 | func buildLambdaProxy() error { |
nothing calls this directly
no test coverage detected