diff --git a/.gitignore b/.gitignore index 717f5fb2a..5898650a0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ target/ build/ node_modules/ **/npm/bin/ -integration/*.log diff --git a/bin/test/test_prerequisites.ps1 b/bin/test/test_prerequisites.ps1 index 6e9c670d0..00efba6dd 100644 --- a/bin/test/test_prerequisites.ps1 +++ b/bin/test/test_prerequisites.ps1 @@ -12,28 +12,29 @@ if ($LASTEXITCODE) { Throw } # start mock servers cd $project_root_path\integration +New-Item -ItemType Directory -Force -Path build -Start-Process powershell -WindowStyle Hidden { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" 2>&1 > mitmdump.log } +Start-Process powershell -WindowStyle Hidden { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" 2>&1 > build\mitmdump.log } if ($LASTEXITCODE) { Throw } sleep 5 if (netstat -ano | Select-String LISTENING | Select-string 0.0.0.0:8888) {powershell write-host -foregroundcolor Green "mitmdump is up"} else {powershell write-host -foregroundcolor Red "mitmdump is down" ; exit 1} -Start-Process powershell -WindowStyle Hidden { python server.py 2>&1 > server.log } +Start-Process powershell -WindowStyle Hidden { python server.py 2>&1 > build\server.log } if ($LASTEXITCODE) { Throw } sleep 5 if (netstat -ano | Select-String LISTENING | Select-string 127.0.0.1:8000) {powershell write-host -foregroundcolor Green "server is up"} else {powershell write-host -foregroundcolor Red "server is down" ; exit 1} -Start-Process powershell -WindowStyle Hidden { python ssl/server.py 8001 ssl/server/cert.selfsigned.pem false 2>&1 > server-ssl-selfsigned.log } +Start-Process powershell -WindowStyle Hidden { python ssl/server.py 8001 ssl/server/cert.selfsigned.pem false 2>&1 > build\server-ssl-selfsigned.log } if ($LASTEXITCODE) { Throw } sleep 5 if (netstat -ano | Select-String LISTENING | Select-string 127.0.0.1:8001) {powershell write-host -foregroundcolor Green "server-ssl-selfsigned up"} else {powershell write-host -foregroundcolor Red "server-ssl-selfsigned is down" ; exit 1} -Start-Process powershell -WindowStyle Hidden { python ssl/server.py 8002 ssl/server/cert.pem false 2>&1 > server-ssl-signedbyca.log } +Start-Process powershell -WindowStyle Hidden { python ssl/server.py 8002 ssl/server/cert.pem false 2>&1 > build\server-ssl-signedbyca.log } if ($LASTEXITCODE) { Throw } sleep 5 if (netstat -ano | Select-String LISTENING | Select-string 127.0.0.1:8002) {powershell write-host -foregroundcolor Green "server-ssl-signedbyca up"} else {powershell write-host -foregroundcolor Red "server-ssl-signedbyca is down" ; exit 1} -Start-Process powershell -WindowStyle Hidden { python ssl/server.py 8003 ssl/server/cert.pem true 2>&1 > server-ssl-client-authent.log } +Start-Process powershell -WindowStyle Hidden { python ssl/server.py 8003 ssl/server/cert.pem true 2>&1 > build\server-ssl-client-authent.log } if ($LASTEXITCODE) { Throw } sleep 5 if (netstat -ano | Select-String LISTENING | Select-string 127.0.0.1:8003) {powershell write-host -foregroundcolor Green "server-ssl-client-authent up"} else {powershell write-host -foregroundcolor Red "server-ssl-client-authent is down" ; exit 1} diff --git a/bin/test/test_prerequisites.sh b/bin/test/test_prerequisites.sh index 14e4b280d..9b5b1711a 100755 --- a/bin/test/test_prerequisites.sh +++ b/bin/test/test_prerequisites.sh @@ -32,24 +32,25 @@ pip3 install --requirement bin/requirements-frozen.txt echo "----- start servers -----" cd integration +mkdir -p build echo -e "\n------------------ Starting server.py" -(python3 server.py >server.log 2>&1 || true) & +(python3 server.py > build/server.log 2>&1 || true) & check_listen_port "server.py" 8000 echo -e "\n------------------ Starting ssl/server.py (Self-signed certificate)" -(python3 ssl/server.py 8001 ssl/server/cert.selfsigned.pem false > server-ssl-selfsigned.log 2>&1 || true) & +(python3 ssl/server.py 8001 ssl/server/cert.selfsigned.pem false > build/server-ssl-selfsigned.log 2>&1 || true) & check_listen_port "ssl/server.py" 8001 echo -e "\n------------------ Starting ssl/server.py (Signed by CA)" -(python3 ssl/server.py 8002 ssl/server/cert.pem false > server-ssl-signedbyca.log 2>&1 || true) & +(python3 ssl/server.py 8002 ssl/server/cert.pem false > build/server-ssl-signedbyca.log 2>&1 || true) & check_listen_port "ssl/server.py" 8002 echo -e "\n------------------ Starting ssl/server.py (Self-signed certificate + Client certificate authentication)" -(python3 ssl/server.py 8003 ssl/server/cert.selfsigned.pem true > server-ssl-client-authent.log 2>&1 || true) & +(python3 ssl/server.py 8003 ssl/server/cert.selfsigned.pem true > build/server-ssl-client-authent.log 2>&1 || true) & check_listen_port "ssl/server.py" 8003 echo -e "\n------------------ Starting mitmdump" -(mitmdump --listen-host 127.0.0.1 --listen-port 8888 --modify-header "/From-Proxy/Hello" >mitmproxy.log 2>&1 ||true) & +(mitmdump --listen-host 127.0.0.1 --listen-port 8888 --modify-header "/From-Proxy/Hello" > build/mitmproxy.log 2>&1 ||true) & check_listen_port "mitmdump" 8888