Skip to content

Commit

Permalink
build: Integration Test
Browse files Browse the repository at this point in the history
use more reliable way to determine project root
  • Loading branch information
developStorm committed May 20, 2024
1 parent dc1454a commit 65f23d5
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 19 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Integration Test
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Check out source
uses: actions/checkout@v4

- name: Prep test dependencies
run: |
set -e
sudo wget https://github.com/jmespath/jp/releases/download/0.2.1/jp-linux-amd64 -O /usr/local/bin/jp
sudo chmod +x /usr/local/bin/jp
pip install --user zschema
- name: Run tests
run: |
make integration-test
2 changes: 1 addition & 1 deletion docker-runner/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
: "${CONTAINER_NAME:?}"

set -e
docker run --rm --link $CONTAINER_NAME:target -e ZGRAB_TARGET=target zgrab2_runner $@
echo 'target' | docker run --rm -i --link $CONTAINER_NAME:target zgrab2_runner $@
2 changes: 1 addition & 1 deletion integration_tests/.template/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
MODULE_DIR=$(dirname $0)
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

mkdir -p $ZGRAB_OUTPUT/#{MODULE_NAME}
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/ftp/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e
MODULE_DIR=$(dirname $0)
TEST_ROOT=$MODULE_DIR/..
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

CONTAINER_NAME="zgrab_ftp"
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/http/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e
MODULE_DIR=$(dirname $0)
TEST_ROOT=$MODULE_DIR/..
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

OUTPUT_ROOT=$ZGRAB_OUTPUT/http
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/ipp/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
MODULE_DIR=$(dirname $0)
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

OUTPUT_ROOT=$ZGRAB_OUTPUT/ipp
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/mongodb/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
versions="3.2.20 3.6.6 4.0.1 4.1.2"

MODULE_DIR=$(dirname $0)
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

mkdir -p $ZGRAB_OUTPUT/mongodb
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/mssql/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

echo "mssql/setup: Tests setup for mssql"

CONTAINER_IMAGE="microsoft/mssql-server-linux"
CONTAINER_VERSION="2017-CU3"
CONTAINER_IMAGE="mcr.microsoft.com/mssql/server"
CONTAINER_VERSION="2017-latest"
CONTAINER_NAME="zgrab_mssql-2017-linux"

# Supported MSSQL_PRODUCT_ID values are Developer, Express, Standard, Enterprise, EnterpriseCore
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/mssql/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e
MODULE_DIR=$(dirname $0)
TEST_ROOT=$MODULE_DIR/..
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

CONTAINER_NAME="zgrab_mssql-2017-linux"
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/mysql/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ versions="5.5 5.6 5.7 8.0"

MODULE_DIR=$(dirname $0)
TEST_ROOT=$MODULE_DIR/..
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

status=0
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/ntp/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e
MODULE_DIR=$(dirname $0)
TEST_ROOT=$MODULE_DIR/..
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

OUTPUT_ROOT=$ZGRAB_OUTPUT/ntp
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/pop3/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
MODULE_DIR=$(dirname $0)
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

mkdir -p $ZGRAB_OUTPUT/pop3
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/postgres/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
versions="9.3 9.4 9.5 9.6 10.1"
types="ssl nossl"

ZGRAB_ROOT=$(dirname $0)/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

mkdir -p $ZGRAB_OUTPUT/postgres
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/redis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
MODULE_DIR=$(dirname $0)
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

# FIXME: Find a way to mount host to container and have it pass CircleCI tests.
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -e

# Run from root of project
TEST_DIR=$(dirname "$0")
ZGRAB_ROOT="$TEST_DIR/.."
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
cd "$ZGRAB_ROOT"

echo "Setting up integration tests..."
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/smtp/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
MODULE_DIR=$(dirname $0)
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

mkdir -p $ZGRAB_OUTPUT/smtp
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/ssh/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e
MODULE_DIR=$(dirname $0)
TEST_ROOT=$MODULE_DIR/..
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

CONTAINER_NAME="zgrab_ssh"
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/telnet/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
MODULE_DIR=$(dirname $0)
ZGRAB_ROOT=$MODULE_DIR/../..
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output

mkdir -p $ZGRAB_OUTPUT/telnet
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set -o pipefail

# Run from root of project
TEST_DIR=$(dirname "$0")
ZGRAB_ROOT="$TEST_DIR/.."
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
INTEGRATION_TEST_VENV=".integration_tests.venv"

cd "$ZGRAB_ROOT"
Expand Down

0 comments on commit 65f23d5

Please sign in to comment.