Skip to content

Commit

Permalink
specify package name in go file and add run test script
Browse files Browse the repository at this point in the history
  • Loading branch information
MGTheTrain committed Nov 13, 2024
1 parent 7a24a91 commit 4f11205
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/infrastructure/connector/az_blob.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package connector
1 change: 1 addition & 0 deletions internal/infrastructure/connector/az_postgres.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package connector
1 change: 1 addition & 0 deletions internal/infrastructure/connector/az_vault.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package connector
48 changes: 48 additions & 0 deletions scripts/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

set -euo pipefail

SCRIPT_DIR=$(dirname "$BASH_SOURCE")
ROOT_PROJECT_DIR=$SCRIPT_DIR/..

cd $ROOT_PROJECT_DIR

BLUE='\033[0;34m'
NC='\033[0m'

# Default flag values
RUN_UNIT_TESTS=true
RUN_INTEGRATION_TESTS=true

# Parse arguments
while getopts "ui" opt; do
case ${opt} in
u)
RUN_UNIT_TESTS=true
RUN_INTEGRATION_TESTS=false
;;
i)
RUN_UNIT_TESTS=false
RUN_INTEGRATION_TESTS=true
;;
*)
echo "Usage: $0 [-u] (for unit tests) [-i] (for integration tests)"
exit 1
;;
esac
done

echo "#####################################################################################################"
echo -e "$BLUE INFO: $NC About to run tests based on the flags"

if [ "$RUN_UNIT_TESTS" = true ]; then
echo -e "$BLUE INFO: $NC Running unit tests..."
go test ./test/unit/...
fi

if [ "$RUN_INTEGRATION_TESTS" = true ]; then
echo -e "$BLUE INFO: $NC Running integration tests..."
go test ./test/integration
fi

cd $SCRIPT_DIR
1 change: 1 addition & 0 deletions test/unit/infrastructure/connector/az_blob_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package connector
1 change: 1 addition & 0 deletions test/unit/infrastructure/connector/az_postgres_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package connector
1 change: 1 addition & 0 deletions test/unit/infrastructure/connector/az_vault_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package connector

0 comments on commit 4f11205

Please sign in to comment.