Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ bazel-*
tmp
launchSettings.json
.cr/
/gapic-showcase
/gapic-showcase.exe
/showcase.pid
/showcase.log
Comment on lines +14 to +17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we clean up after ourselves instead?

44 changes: 44 additions & 0 deletions runintegrationtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# This script:
# - Builds the Generator solution in Release mode
# - Starts GAPIC Showcase
# - Runs integration tests for the Generator projects in Release mode
# - Tears down GAPIC Showcase on exit

set -e

cd "$(dirname "$0")"

export DOTNET_NOLOGO=true

CONFIG=Release
DOTNET_BUILD_ARGS="-c $CONFIG"
DOTNET_TEST_ARGS="--no-build $DOTNET_BUILD_ARGS"

echo "Building the solution in $CONFIG mode"
dotnet build $DOTNET_BUILD_ARGS Generator.sln

cleanup() {
echo "Tearing down GAPIC Showcase"
if [ -f showcase.pid ]; then
kill "$(cat showcase.pid)" 2>/dev/null || true
rm -f showcase.pid
fi
rm -f gapic-showcase gapic-showcase.exe
}
Comment thread
robertvoinescu-work marked this conversation as resolved.
trap cleanup EXIT

echo "Setup GAPIC Showcase for standard integration tests"
./startshowcase.sh --port :7469

export SHOWCASE_ENDPOINT=http://localhost:7469
dotnet test $DOTNET_TEST_ARGS Google.Api.Generator.IntegrationTests

echo "Setup GAPIC Showcase with TLS for PQC integration tests"
./startshowcase.sh --port :7469 --tls

export SHOWCASE_ENDPOINT=https://localhost:7469
dotnet test $DOTNET_TEST_ARGS Google.Api.Generator.IntegrationTests --filter "FullyQualifiedName~Pqc"
Comment thread
robertvoinescu-work marked this conversation as resolved.
Comment on lines +32 to +42

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything should run now under TLS, that's closer to real life.

Suggested change
echo "Setup GAPIC Showcase for standard integration tests"
./startshowcase.sh --port :7469
export SHOWCASE_ENDPOINT=http://localhost:7469
dotnet test $DOTNET_TEST_ARGS Google.Api.Generator.IntegrationTests
echo "Setup GAPIC Showcase with TLS for PQC integration tests"
./startshowcase.sh --port :7469 --tls
export SHOWCASE_ENDPOINT=https://localhost:7469
dotnet test $DOTNET_TEST_ARGS Google.Api.Generator.IntegrationTests --filter "FullyQualifiedName~Pqc"
echo "Setup GAPIC Showcase"
./startshowcase.sh --port :7469 --tls
export SHOWCASE_ENDPOINT=https://localhost:7469
dotnet test $DOTNET_TEST_ARGS Google.Api.Generator.IntegrationTests


echo "Integration testing completed"
52 changes: 52 additions & 0 deletions startshowcase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
set -eo pipefail

cd "$(dirname "$0")"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then OS="linux"; elif [[ "$OSTYPE" == "darwin"* ]]; then OS="darwin"; else OS="windows"; fi

ARCH="amd64"
if [[ "$OS" == "darwin" && $(uname -m) == "arm64" ]]; then
ARCH="arm64"
fi

# Clean up any previously running instance
if [ -f showcase.pid ]; then
kill "$(cat showcase.pid)" 2>/dev/null || true
rm -f showcase.pid
fi
pkill -f "gapic-showcase run" 2>/dev/null || true
sleep 1

if [ ! -f gapic-showcase ] && [ ! -f gapic-showcase.exe ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to always run with the latest version?

echo "Resolving the latest GAPIC Showcase version for $OS-$ARCH..."
SHOWCASE_VERSION=$(curl -s https://api.github.com/repos/googleapis/gapic-showcase/releases/latest | sed -n 's/.*"tag_name": "v\([^"]*\)".*/\1/p' || true)
if [[ -z "$SHOWCASE_VERSION" ]]; then
# Fallback to known stable version if GitHub API rate limit is exceeded
SHOWCASE_VERSION="0.43.0"
Comment thread
robertvoinescu-work marked this conversation as resolved.
echo "Warning: Failed to resolve latest GAPIC Showcase version from GitHub; falling back to v${SHOWCASE_VERSION}." >&2
fi

echo "Downloading gapic-showcase-${SHOWCASE_VERSION}-${OS}-${ARCH}..."
curl -sSL -f https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-${OS}-${ARCH}.tar.gz | tar -zx
fi

if [ $# -eq 0 ]; then
set -- --port :7469
fi

if [[ "$OS" == "windows" ]]; then
./gapic-showcase.exe run "$@" > showcase.log 2>&1 &
else
./gapic-showcase run "$@" > showcase.log 2>&1 &
fi

# Write the PID to a file so the caller can easily tear it down
echo $! > showcase.pid
echo "Showcase started with PID $!"
sleep 2
if ! kill -0 "$!" 2>/dev/null; then
echo "gapic-showcase failed to start. Please check showcase.log for details." >&2
cat showcase.log >&2 || true
exit 1
fi
Loading