mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-10-25 11:17:28 +02:00 
			
		
		
		
	tests
This commit is contained in:
		
							parent
							
								
									c853465d1d
								
							
						
					
					
						commit
						eda91cc556
					
				| @ -9,9 +9,9 @@ services: | |||||||
|           memory: 1G |           memory: 1G | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -q 'Please sign in'"] |       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -q 'Please sign in'"] | ||||||
|       interval: 30s |       interval: 5s | ||||||
|       timeout: 10s |       timeout: 10s | ||||||
|       retries: 3 |       retries: 16 | ||||||
|     ports: |     ports: | ||||||
|       - 8080:8080 |       - 8080:8080 | ||||||
|     volumes: |     volumes: | ||||||
|  | |||||||
| @ -9,9 +9,9 @@ services: | |||||||
|           memory: 1G |           memory: 1G | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -qv 'Please sign in'"] |       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -qv 'Please sign in'"] | ||||||
|       interval: 20s |       interval: 5s | ||||||
|       timeout: 10s |       timeout: 10s | ||||||
|       retries: 3 |       retries: 16 | ||||||
|     ports: |     ports: | ||||||
|       - 8080:8080 |       - 8080:8080 | ||||||
|     volumes: |     volumes: | ||||||
|  | |||||||
| @ -9,9 +9,9 @@ services: | |||||||
|           memory: 1G |           memory: 1G | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -q 'Please sign in'"] |       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -q 'Please sign in'"] | ||||||
|       interval: 20s |       interval: 5s | ||||||
|       timeout: 10s |       timeout: 10s | ||||||
|       retries: 3 |       retries: 16 | ||||||
|     ports: |     ports: | ||||||
|       - 8080:8080 |       - 8080:8080 | ||||||
|     volumes: |     volumes: | ||||||
|  | |||||||
| @ -9,9 +9,9 @@ services: | |||||||
|           memory: 1G |           memory: 1G | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -q 'Please sign in'"] |       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -q 'Please sign in'"] | ||||||
|       interval: 30s |       interval: 5s | ||||||
|       timeout: 10s |       timeout: 10s | ||||||
|       retries: 3 |       retries: 16 | ||||||
|     ports: |     ports: | ||||||
|       - 8080:8080 |       - 8080:8080 | ||||||
|     volumes: |     volumes: | ||||||
|  | |||||||
| @ -9,9 +9,9 @@ services: | |||||||
|           memory: 1G |           memory: 1G | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -qv 'Please sign in'"] |       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -qv 'Please sign in'"] | ||||||
|       interval: 20s |       interval: 5s | ||||||
|       timeout: 10s |       timeout: 10s | ||||||
|       retries: 3 |       retries: 16 | ||||||
|     ports: |     ports: | ||||||
|       - 8080:8080 |       - 8080:8080 | ||||||
|     volumes: |     volumes: | ||||||
|  | |||||||
| @ -9,9 +9,9 @@ services: | |||||||
|           memory: 1G |           memory: 1G | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -qv 'Please sign in'"] |       test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -qv 'Please sign in'"] | ||||||
|       interval: 30s |       interval: 5s | ||||||
|       timeout: 10s |       timeout: 10s | ||||||
|       retries: 3 |       retries: 16 | ||||||
|     ports: |     ports: | ||||||
|       - 8080:8080 |       - 8080:8080 | ||||||
|     volumes: |     volumes: | ||||||
|  | |||||||
							
								
								
									
										28
									
								
								test.sh
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								test.sh
									
									
									
									
									
								
							| @ -6,16 +6,17 @@ check_health() { | |||||||
|     local compose_file=$2 |     local compose_file=$2 | ||||||
|     local end=$((SECONDS+60)) |     local end=$((SECONDS+60)) | ||||||
| 
 | 
 | ||||||
|     echo "Waiting for $service_name to become healthy..." |     echo -n "Waiting for $service_name to become healthy..." | ||||||
|     until [ "$(docker inspect --format='{{json .State.Health.Status}}' "$service_name")" == '"healthy"' ] || [ $SECONDS -ge $end ]; do | 	until [ "$(docker inspect --format='{{json .State.Health.Status}}' "$service_name")" == '"healthy"' ] || [ $SECONDS -ge $end ]; do | ||||||
|         sleep 10 | 		sleep 3 | ||||||
|         echo "Waiting..." | 		echo -n "." | ||||||
|         if [ $SECONDS -ge $end ]; then | 		if [ $SECONDS -ge $end ]; then | ||||||
|             echo "$service_name health check timed out after 80 seconds." | 			echo -e "\n$service_name health check timed out after 80 seconds." | ||||||
|             return 1 | 			return 1 | ||||||
|         fi | 		fi | ||||||
|     done | 	done | ||||||
|     echo "$service_name is healthy!" | 	echo -e "\n$service_name is healthy!" | ||||||
|  | 
 | ||||||
|     return 0 |     return 0 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -63,6 +64,8 @@ run_tests() { | |||||||
| 
 | 
 | ||||||
| # Main testing routine | # Main testing routine | ||||||
| main() { | main() { | ||||||
|  | 	SECONDS=0 | ||||||
|  | 	 | ||||||
|     export DOCKER_ENABLE_SECURITY=false |     export DOCKER_ENABLE_SECURITY=false | ||||||
|     ./gradlew clean build |     ./gradlew clean build | ||||||
| 
 | 
 | ||||||
| @ -90,8 +93,7 @@ main() { | |||||||
|     run_tests "Stirling-PDF-Security" "./exampleYmlFiles/docker-compose-latest-security.yml" |     run_tests "Stirling-PDF-Security" "./exampleYmlFiles/docker-compose-latest-security.yml" | ||||||
| 
 | 
 | ||||||
|     # Report results |     # Report results | ||||||
|     echo "All tests completed." |     echo "All tests completed in $SECONDS seconds." | ||||||
|      |  | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
| 	if [ ${#passed_tests[@]} -ne 0 ]; then | 	if [ ${#passed_tests[@]} -ne 0 ]; then | ||||||
| @ -108,6 +110,8 @@ main() { | |||||||
|         echo -e "\e[31m$test\e[0m"  # Red color for failed tests |         echo -e "\e[31m$test\e[0m"  # Red color for failed tests | ||||||
|     done |     done | ||||||
| 
 | 
 | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
|     # Check if there are any failed tests and exit with an error code if so |     # Check if there are any failed tests and exit with an error code if so | ||||||
|     if [ ${#failed_tests[@]} -ne 0 ]; then |     if [ ${#failed_tests[@]} -ne 0 ]; then | ||||||
|         echo "Some tests failed." |         echo "Some tests failed." | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user