mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
Create shell scripts for consistent test invocation across CI environments: Python script (python-sdk/scripts/run_integration_tests.sh): - Auto-detects virtual environment or uses system Python - Installs package in editable mode if not present - Runs test_integration_e2e.py with verbose output - Supports passing extra pytest arguments Go script (server/public/pluginapi/grpc/scripts/run_integration_tests.sh): - Runs from the correct module directory - Filters to TestPythonPlugin and TestIntegration tests - Disables test caching for clean CI runs - Supports passing extra go test arguments Both scripts: - Are executable (chmod +x) - Print diagnostic information (working dir, version) - Exit with appropriate error codes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.6 KiB
Bash
Executable file
50 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
# See LICENSE.txt for license information.
|
|
|
|
# CI-friendly script for running Python integration tests.
|
|
# This script provides consistent test invocation across environments.
|
|
#
|
|
# Usage:
|
|
# ./scripts/run_integration_tests.sh
|
|
# ./scripts/run_integration_tests.sh -v --tb=long # Pass extra args to pytest
|
|
|
|
set -e
|
|
|
|
# Navigate to the python-sdk directory
|
|
cd "$(dirname "$0")/.."
|
|
|
|
echo "Running Python integration tests..."
|
|
echo "Working directory: $(pwd)"
|
|
|
|
# Check if virtual environment exists and activate it
|
|
if [ -d ".venv" ]; then
|
|
echo "Using virtual environment at .venv"
|
|
PYTHON=".venv/bin/python"
|
|
else
|
|
echo "No virtual environment found, using system Python"
|
|
PYTHON="python3"
|
|
fi
|
|
|
|
# Verify Python is available
|
|
if ! command -v "$PYTHON" &> /dev/null; then
|
|
echo "ERROR: Python not found. Please install Python 3.9+ or create a virtual environment."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Python version: $($PYTHON --version)"
|
|
|
|
# Install package if needed (editable install for development)
|
|
if ! $PYTHON -c "import mattermost_plugin" 2>/dev/null; then
|
|
echo "Installing mattermost-plugin-sdk in editable mode..."
|
|
$PYTHON -m pip install -e ".[dev]" --quiet
|
|
fi
|
|
|
|
# Run integration tests
|
|
# -v: verbose output
|
|
# --tb=short: shorter tracebacks
|
|
# Extra arguments passed to this script are forwarded to pytest
|
|
echo "Executing: $PYTHON -m pytest tests/test_integration_e2e.py -v --tb=short $@"
|
|
$PYTHON -m pytest tests/test_integration_e2e.py -v --tb=short "$@"
|
|
|
|
echo "Integration tests completed successfully."
|