Skip to content

Commit ade631a

Browse files
V3 E2E test coverage and testing script utils
Signed-off-by: Lukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot)
1 parent 7c4ef38 commit ade631a

18 files changed

+520
-0
lines changed

utils/v4/docs/get_api_docs.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# Get API documentation (public endpoint, no auth required)
3+
# Usage: ./get_api_docs.sh
4+
# API_URL=http://localhost:5001 ./get_api_docs.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service ./get_api_docs.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle API URL
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
11+
12+
# Set up curl execution
13+
API="${API_URL}/v4/api-docs"
14+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\""
15+
USE_JQ=false
16+
. ./utils/shared/handle_curl_execution.sh

utils/v4/docs/get_swagger_json.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# Get Swagger JSON specification (public endpoint, no auth required)
3+
# Usage: ./get_swagger_json.sh
4+
# API_URL=http://localhost:5001 ./get_swagger_json.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service ./get_swagger_json.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle API URL
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
11+
12+
# Set up curl execution
13+
API="${API_URL}/v4/swagger.json"
14+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\""
15+
USE_JQ=true
16+
. ./utils/shared/handle_curl_execution.sh
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Test ALL V4 Documentation API endpoints
3+
# Usage: ./test_all_docs_apis.sh
4+
# API_URL=http://localhost:5001 ./test_all_docs_apis.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service ./test_all_docs_apis.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle API URL
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
11+
12+
echo "=== Testing V4 Documentation API Endpoints ==="
13+
echo "API_URL: ${API_URL}"
14+
echo ""
15+
16+
echo "1. Testing GET /api-docs (public endpoint)"
17+
echo " Command: ${SCRIPT_DIR}/get_api_docs.sh"
18+
${SCRIPT_DIR}/get_api_docs.sh
19+
echo ""
20+
21+
echo "2. Testing GET /swagger.json (public endpoint)"
22+
echo " Command: ${SCRIPT_DIR}/get_swagger_json.sh"
23+
${SCRIPT_DIR}/get_swagger_json.sh
24+
echo ""
25+
26+
echo "=== V4 Documentation API Testing Complete ==="

utils/v4/health/get_health.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# Get application health status (public endpoint, no auth required)
3+
# Usage: ./get_health.sh
4+
# API_URL=http://localhost:5001 ./get_health.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service ./get_health.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle API URL
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
11+
12+
# Set up curl execution
13+
API="${API_URL}/v4/ops/health"
14+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\""
15+
USE_JQ=true
16+
. ./utils/shared/handle_curl_execution.sh
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Test ALL V4 Health API endpoints
3+
# Usage: ./test_all_health_apis.sh
4+
# API_URL=http://localhost:5001 ./test_all_health_apis.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service ./test_all_health_apis.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle API URL
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
11+
12+
echo "=== Testing V4 Health API Endpoints ==="
13+
echo "API_URL: ${API_URL}"
14+
echo ""
15+
16+
echo "1. Testing GET /ops/health (public endpoint)"
17+
echo " Command: ${SCRIPT_DIR}/get_health.sh"
18+
${SCRIPT_DIR}/get_health.sh
19+
echo ""
20+
21+
echo "=== V4 Health API Testing Complete ==="
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Get CLA manager distribution for EasyCLA (authenticated)
3+
# Usage: ./get_cla_manager_distribution.sh
4+
# TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_cla_manager_distribution.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_cla_manager_distribution.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle authentication
10+
. ./utils/shared/handle_auth.sh
11+
12+
# Handle API URL
13+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
14+
15+
# Set up curl execution
16+
API="${API_URL}/v4/metrics/cla-manager-distribution"
17+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\" -H \"X-ACL: ${XACL}\" -H \"Authorization: Bearer ${TOKEN}\""
18+
USE_JQ=true
19+
. ./utils/shared/handle_curl_execution.sh
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# Get metrics of a specific company (authenticated)
3+
# Usage: ./get_company_metric.sh <company_id>
4+
# Example: ./get_company_metric.sh a1b86c26-d8e8-4fd8-9f8d-5c723d5dac9f
5+
# TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_company_metric.sh <company_id>
6+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_company_metric.sh <company_id>
7+
8+
if [ -z "$1" ]
9+
then
10+
echo "$0: you need to specify company_id as a 1st parameter"
11+
echo "Usage: $0 <company_id>"
12+
echo "Example: $0 a1b86c26-d8e8-4fd8-9f8d-5c723d5dac9f"
13+
exit 1
14+
fi
15+
export company_id="$1"
16+
17+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18+
19+
# Handle authentication
20+
. ./utils/shared/handle_auth.sh
21+
22+
# Handle API URL
23+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
24+
25+
# Set up curl execution
26+
API="${API_URL}/v4/metrics/company/${company_id}"
27+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\" -H \"X-ACL: ${XACL}\" -H \"Authorization: Bearer ${TOKEN}\""
28+
USE_JQ=true
29+
. ./utils/shared/handle_curl_execution.sh
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Get metrics of a specific project (authenticated)
3+
# Usage: ./get_project_metric.sh <project_id> [id_type]
4+
# Example: ./get_project_metric.sh a09P000000DsNH2IAN salesforce
5+
# Example: ./get_project_metric.sh project-uuid
6+
# TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_project_metric.sh <project_id> [id_type]
7+
8+
if [ -z "$1" ]
9+
then
10+
echo "$0: you need to specify project_id as a 1st parameter"
11+
echo "Usage: $0 <project_id> [id_type]"
12+
echo "Example: $0 a09P000000DsNH2IAN salesforce"
13+
echo "Example: $0 project-uuid"
14+
exit 1
15+
fi
16+
export project_id="$1"
17+
export id_type="$2"
18+
19+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20+
21+
# Handle authentication
22+
. ./utils/shared/handle_auth.sh
23+
24+
# Handle API URL
25+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
26+
27+
# Build query parameters
28+
QUERY_PARAMS=""
29+
if [ ! -z "$id_type" ]; then
30+
QUERY_PARAMS="idType=${id_type}"
31+
fi
32+
33+
# Set up curl execution
34+
API="${API_URL}/v4/metrics/project/${project_id}"
35+
if [ ! -z "$QUERY_PARAMS" ]; then
36+
API="${API}?${QUERY_PARAMS}"
37+
fi
38+
39+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\" -H \"X-ACL: ${XACL}\" -H \"Authorization: Bearer ${TOKEN}\""
40+
USE_JQ=true
41+
. ./utils/shared/handle_curl_execution.sh
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Get top company metrics (authenticated)
3+
# Usage: ./get_top_companies.sh
4+
# TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_top_companies.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_top_companies.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle authentication
10+
. ./utils/shared/handle_auth.sh
11+
12+
# Handle API URL
13+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
14+
15+
# Set up curl execution
16+
API="${API_URL}/v4/metrics/top-companies"
17+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\" -H \"X-ACL: ${XACL}\" -H \"Authorization: Bearer ${TOKEN}\""
18+
USE_JQ=true
19+
. ./utils/shared/handle_curl_execution.sh
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Get project metrics of the top projects (authenticated)
3+
# Usage: ./get_top_projects.sh
4+
# TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_top_projects.sh
5+
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service TOKEN="$(cat ./token.secret)" XACL="$(cat ./x-acl.secret)" ./get_top_projects.sh
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Handle authentication
10+
. ./utils/shared/handle_auth.sh
11+
12+
# Handle API URL
13+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
14+
15+
# Set up curl execution
16+
API="${API_URL}/v4/metrics/top-projects"
17+
CURL_CMD="curl -s -XGET -H \"Content-Type: application/json\" -H \"X-ACL: ${XACL}\" -H \"Authorization: Bearer ${TOKEN}\""
18+
USE_JQ=true
19+
. ./utils/shared/handle_curl_execution.sh

0 commit comments

Comments
 (0)