Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHEE-687] minikube #111

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
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
126 changes: 56 additions & 70 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,62 +292,62 @@ jobs:

# # For remote access to minikube uncomment the following lines.
# #---------------------minikube remote aceess start---------------------
# sudo apt install nginx
# sudo touch /etc/nginx/conf.d/minikube.conf
# echo "create nginx conf"
# sudo chmod 777 -R /etc/nginx/conf.d/
# echo "changed access"
sudo apt install nginx
sudo touch /etc/nginx/conf.d/minikube.conf
echo "create nginx conf"
sudo chmod 777 -R /etc/nginx/conf.d/
echo "changed access"

# sudo apt-get install apache2-utils -y
# echo "apache2-utils installed"
# htpasswd -bc /home/circleci/project/.htpasswd minikube minikube
sudo apt-get install apache2-utils -y
echo "apache2-utils installed"
htpasswd -bc /home/circleci/project/.htpasswd minikube minikube

# sudo cat \<<EOF > /etc/nginx/conf.d/minikube.conf
# server {
# listen 8080;
# listen [::]:8080;
# server_name localhost;
# access_log /home/circleci/project/nginx_access.log;
# auth_basic "Administrators Area";
# auth_basic_user_file /home/circleci/project/.htpasswd;
sudo cat \<<EOF > /etc/nginx/conf.d/minikube.conf
server {
listen 8080;
listen [::]:8080;
server_name localhost;
access_log /home/circleci/project/nginx_access.log;
auth_basic "Administrators Area";
auth_basic_user_file /home/circleci/project/.htpasswd;

# location / {
# proxy_pass https://$MINIKUBE_IP:8443;
# proxy_ssl_certificate /home/circleci/.minikube/profiles/minikube/client.crt;
# proxy_ssl_certificate_key /home/circleci/.minikube/profiles/minikube/client.key;
# }
# }
# EOF
# sudo service nginx restart || echo 'start nginx'
# SYSTEMD_LESS=FRXMK systemctl status nginx.service
location / {
proxy_pass https://$MINIKUBE_IP:8443;
proxy_ssl_certificate /home/circleci/.minikube/profiles/minikube/client.crt;
proxy_ssl_certificate_key /home/circleci/.minikube/profiles/minikube/client.key;
}
}
EOF
sudo service nginx restart || echo 'start nginx'
SYSTEMD_LESS=FRXMK systemctl status nginx.service

# sleep 10
# echo "test-nginx-proxy"
# curl -u minikube:minikube http://localhost:8080
sleep 10

echo "test-nginx-proxy"
curl -u minikube:minikube http://localhost:8080

# curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
# ngrok config add-authtoken $AUTH_TOKEN
# echo "web_addr: $LOCAL_PORT" >> /home/circleci/.config/ngrok/ngrok.yml
# ngrok http 8080 > /dev/null &
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
ngrok config add-authtoken $AUTH_TOKEN
echo "web_addr: $LOCAL_PORT" >> /home/circleci/.config/ngrok/ngrok.yml
ngrok http 8080 > /dev/null &

# echo -n "Extracting ngrok public url ."
# NGROK_PUBLIC_URL=""
# while [ -z "$NGROK_PUBLIC_URL" ]; do
# # Run 'curl' against ngrok API and extract public (using 'sed' command)
# export NGROK_PUBLIC_URL=$(curl --silent --max-time 10 --connect-timeout 5 \
# --show-error http://127.0.0.1:$LOCAL_PORT/api/tunnels | \
# sed -nE 's/.*public_url":"https:..([^"]*).*/\1/p')
# sleep 1
# echo -n "."
# done
# echo ---------copy the below public_URL for NGrok----------
# echo "https://$NGROK_PUBLIC_URL"
# echo "https://$NGROK_PUBLIC_URL"
echo -n "Extracting ngrok public url ."
NGROK_PUBLIC_URL=""
while [ -z "$NGROK_PUBLIC_URL" ]; do
# Run 'curl' against ngrok API and extract public (using 'sed' command)
export NGROK_PUBLIC_URL=$(curl --silent --max-time 10 --connect-timeout 5 \
--show-error http://127.0.0.1:$LOCAL_PORT/api/tunnels | \
sed -nE 's/.*public_url":"https:..([^"]*).*/\1/p')
sleep 1
echo -n "."
done
echo ---------copy the below public_URL for NGrok----------
echo "https://$NGROK_PUBLIC_URL"
echo "https://$NGROK_PUBLIC_URL"

# echo "test ngrok "
# curl -u minikube:minikube https://$NGROK_PUBLIC_URL
# echo "https://$NGROK_PUBLIC_URL"
echo "test ngrok "
curl -u minikube:minikube https://$NGROK_PUBLIC_URL
echo "https://$NGROK_PUBLIC_URL"
# # ---------------------minikube remote access end---------------------

curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
Expand All @@ -361,7 +361,7 @@ jobs:
echo ------------MEMORY CHECK -----------

- run:
no_output_timeout: 20m
no_output_timeout: 30m
name: fetch docker images and helm upgrade
environment:
ORB_CHART_BASE_URL: << parameters.chart-base-url >>
Expand Down Expand Up @@ -501,7 +501,7 @@ jobs:
- run:
name: Run Helm Tests
command: |
helm test g2p-sandbox --filter name=g2p-sandbox-test-gov --namespace paymenthub || echo test
# helm test g2p-sandbox --filter name=g2p-sandbox-test-gov --namespace paymenthub || echo test
helm test g2p-sandbox --filter name=g2p-sandbox-test-ams --namespace paymenthub || echo test

- run:
Expand All @@ -510,20 +510,20 @@ jobs:
#!/bin/bash
mkdir -p integration_report/test-report

echo "Fetch Integration Test Report for ams"
echo "Fetch Integration Test Report"
kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-ams |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report
# Specify the path to the downloaded file
downloaded_file="integration_report/test-report/cucumber.xml"
# Loop until the file is not empty
while [ ! -s $downloaded_file ]; do
echo "File is empty, waiting..."
sleep 60 # You can adjust the sleep interval as needed
kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-ams |cut -d " " -f1`:/ph-ee-connector-integration-test/build/ integration_report/test-report
kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-ams |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report
downloaded_file="integration_report/test-report/cucumber.xml"
done
echo "File is no longer empty, processing..."
mv integration_report/test-report/cucumber.xml integration_report/test-report/cucumber_ams.xml
mv integration_report/test-report/reports/tests/test integration_report/test-report/reports/tests/test_ams
# mv integration_report/test-report/reports/tests/test integration_report/test-report/reports/tests/test_ams
# kubectl cp paymenthubb/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-ams |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report

for i in $(kubectl get pods -n paymenthub | grep g2p-sandbox-test-ams |cut -d " " -f1); do
Expand All @@ -534,23 +534,9 @@ jobs:
echo " " >> all_pod_logs.log
done

echo "Fetch Integration Test Report for GOV"
kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-gov |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report
# Specify the path to the downloaded file
downloaded_file="integration_report/test-report/cucumber.xml"
# Loop until the file is not empty
while [ ! -s $downloaded_file ]; do
echo "File is empty, waiting..."
sleep 60 # You can adjust the sleep interval as needed
kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-gov |cut -d " " -f1`:/ph-ee-connector-integration-test/build/ integration_report/test-report
downloaded_file="integration_report/test-report/cucumber.xml"
done
echo "File is no longer empty, processing..."
mv integration_report/test-report/cucumber.xml integration_report/test-report/cucumber_gov.xml
mv integration_report/test-report/reports/tests/test integration_report/test-report/reports/tests/test_gov

mkdir -p integration_report_final
cp integration_report/test-report/cucumber_gov.xml integration_report_final/ || echo ""
# cp integration_report/test-report/cucumber_gov.xml integration_report_final/ || echo ""
cp integration_report/test-report/cucumber_ams.xml integration_report_final/ || echo ""

ls integration_report/test-report/
Expand All @@ -562,7 +548,7 @@ jobs:
echo " " >> all_pod_logs.log
echo " " >> all_pod_logs.log
done
mv all_pod_logs.log integration_report/test-report/reports/tests/
# mv all_pod_logs.log integration_report/test-report/reports/tests/

- store_test_results:
path: integration_report_final/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
imagePullPolicy: "Always"
command: [ "/bin/bash" , "-c" ]
args:
- ./gradlew test -Dcucumber.filter.tags="@amsIntegration" ; echo 'Test complete' ; sleep 1500 ; echo 'pod terminate'
- ./gradlew test -Dcucumber.tags="@amsIntegration or @gov" ; echo 'Test complete' ; sleep 1500 ; echo 'pod terminate'
{{- include "inttest.env" . | nindent 4 }}
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
command: [ "/bin/bash" , "-c" ]
args:
# - ./gradlew test -Dcucumber.filter.tags="@bd012" ; echo 'Test complete' ; sleep 300 ; echo 'pod terminate'
- ./gradlew test -Dcucumber.filter.tags="@gov and not @ext" ; echo 'Test complete' ; sleep 300 ; echo 'pod terminate'
- ./gradlew test -Dcucumber.filter.tags="@gov and not @ext" --no-daemon ; echo 'Test complete' ; sleep 300 ; echo 'pod terminate'
{{- include "inttest.env" . | nindent 4 }}
resources:
limits:
Expand Down