@@ -781,6 +781,153 @@ spec:
781781 # Run pulp_npm functional tests
782782 cmd_prefix bash -c "HOME=/tmp/home PYTHONPATH=/tmp/home/.local/lib/python3.11/site-packages/ XDG_CONFIG_HOME=/tmp/home/.config API_PROTOCOL=http API_HOST=pulp-api API_PORT=8000 ADMIN_USERNAME=admin ADMIN_PASSWORD=$PASSWORD /tmp/home/.local/bin/pytest -o cache_dir=/tmp/home/.cache/pytest_cache -v -r sx --color=yes --pyargs pulp_npm.tests.functional -k 'test_pull_through_install' --junitxml=/tmp/home/junit-pulp-serial.xml" || debug_and_fail
783783
784+ - name : pulp-service-functional-tests
785+ when :
786+ - input : ' $(tasks.test-metadata.results.test-event-type)'
787+ operator : in
788+ values : ["pull_request"]
789+ runAfter :
790+ - install-bindings
791+ params :
792+ - name : BONFIRE_IMAGE
793+ value : " $(params.BONFIRE_IMAGE)"
794+ - name : NS
795+ value : " $(tasks.reserve-namespace.results.NS)"
796+ - name : EPHEMERAL_ENV_PROVIDER_SECRET
797+ value : " $(params.EPHEMERAL_ENV_PROVIDER_SECRET)"
798+ taskSpec :
799+ params :
800+ - name : BONFIRE_IMAGE
801+ type : string
802+ description : The container Bonfire image to use for the tekton tasks
803+ default : quay.io/redhat-user-workloads/hcc-devprod-tenant/hcc-cicd-tools/cicd-tools:834176766e3f911ffa24bfacff59dd15126e4b3a
804+ - name : EPHEMERAL_ENV_PROVIDER_SECRET
805+ type : string
806+ default : ephemeral-env-provider
807+ - name : NS
808+ type : string
809+ description : Namespace name to deploy the application to
810+ steps :
811+ - name : functional-tests
812+ image : " $(params.BONFIRE_IMAGE)"
813+ env :
814+ - name : OC_LOGIN_TOKEN
815+ valueFrom :
816+ secretKeyRef :
817+ name : $(params.EPHEMERAL_ENV_PROVIDER_SECRET)
818+ key : token
819+ - name : OC_LOGIN_SERVER
820+ valueFrom :
821+ secretKeyRef :
822+ name : $(params.EPHEMERAL_ENV_PROVIDER_SECRET)
823+ key : url
824+ - name : NS
825+ value : $(params.NS)
826+ script : |
827+ set -ex
828+
829+ login.sh
830+
831+ if [ -n "$NS" ]; then
832+ oc_wrapper project $NS
833+ else
834+ export NS=$(oc_wrapper project | grep -oE 'ephemeral-......')
835+ fi
836+ echo "Namespace is $NS"
837+
838+ PASSWORD=$(oc_wrapper extract secret/pulp-admin-password --to=-)
839+
840+ POD=$(oc_wrapper get pod | grep -oE "pulp-api\S*")
841+ echo $POD
842+ oc_wrapper get pod $POD -o yaml | grep memory:
843+
844+ oc_wrapper get clowdenvironment env-$(oc_wrapper project | grep -oE 'ephemeral-......') -o yaml
845+
846+ oc_wrapper get clowdapp pulp -o yaml
847+
848+ ### Adapted from ./.github/workflows/scripts/utils.sh
849+ # Run a command
850+ cmd_prefix() {
851+ oc_wrapper exec -c pulp-api deployment/pulp-api -- "$@"
852+ }
853+
854+ # Run a command, and pass STDIN
855+ cmd_stdin_prefix() {
856+ oc_wrapper exec -c pulp-api -i deployment/pulp-api -- "$@"
857+ }
858+ ### END Adapted from ./.github/workflows/scripts/utils.sh
859+
860+ debug_and_fail() {
861+ oc_wrapper logs $(oc_wrapper get pod | grep -oE "pulp-content\S*")
862+ oc_wrapper logs $(oc_wrapper get pod | grep -oE "pulp-api\S*")
863+ echo "CURL OUTPUT"
864+ curl https://env-${NS}.apps.crc-eph.r9lp.p1.openshiftapps.com/api/pulp-content/default/
865+ echo "ROUTES"
866+ oc_wrapper get route
867+ exit 1
868+ }
869+
870+ cmd_prefix bash -c "HOME=/tmp/home pip3 install pytest\<8"
871+ cmd_prefix bash -c "HOME=/tmp/home pip3 install pulp-smash@git+https://github.com/pulp/pulp-smash.git@2ded6671e0f32c51e70681467199e8a195f7f5fe"
872+
873+ cmd_prefix mkdir -p /tmp/home/.config/pulp_smash
874+ cat << EOF >> pulp-smash.json
875+ {
876+ "pulp": {
877+ "auth": [
878+ "admin",
879+ "password"
880+ ],
881+ "selinux enabled": false,
882+ "version": "3"
883+ },
884+ "hosts": [
885+ {
886+ "hostname": "pulp-api",
887+ "roles": {
888+ "api": {
889+ "port": 8000,
890+ "scheme": "http",
891+ "service": "nginx"
892+ },
893+ "content": {
894+ "port": 8000,
895+ "scheme": "https",
896+ "service": "pulp-content"
897+ },
898+ "pulp resource manager": {},
899+ "pulp workers": {},
900+ "redis": {},
901+ "shell": {
902+ "transport": "local"
903+ }
904+ }
905+ }
906+ ]
907+ }
908+ EOF
909+ sed "s#password#${PASSWORD}#g" pulp-smash.json > pulp-smash.customized.json
910+ sed -i "s/pulp-content/env-${NS}.apps.crc-eph.r9lp.p1.openshiftapps.com/g" pulp-smash.customized.json
911+
912+ echo "PULP-SMASH CONFIG:"
913+ cat pulp-smash.customized.json
914+
915+ curl -o functest_requirements.txt https://raw.githubusercontent.com/pulp/pulp_rpm/main/functest_requirements.txt
916+ curl -o unittest_requirements.txt https://raw.githubusercontent.com/pulp/pulp_rpm/main/unittest_requirements.txt
917+
918+ ### Adapted from ./.github/workflows/scripts/script.sh
919+ cat unittest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt"
920+ cat functest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/functest_requirements.txt"
921+ cat pulp-smash.customized.json | cmd_stdin_prefix bash -c "cat > /tmp/home/.config/pulp_smash/settings.json"
922+ cmd_prefix bash -c "HOME=/tmp/home pip3 install -r /tmp/unittest_requirements.txt -r /tmp/functest_requirements.txt"
923+ # Because we pass the path to pytest -o cache_dir=/tmp/home/.cache/pytest_cache, pulpcore-manager must be in the same dir
924+ cmd_prefix bash -c "ln -s /usr/local/lib/pulp/bin/pulpcore-manager /tmp/home/.local/bin/pulpcore-manager || /bin/true"
925+ echo "CURL OUTPUT"
926+ curl https://env-${NS}.apps.crc-eph.r9lp.p1.openshiftapps.com/api/pulp-content/default/
927+ echo "ROUTES"
928+ oc_wrapper get route
929+ set +e
930+
784931 # Run pulp_service functional tests
785932 cmd_prefix bash -c "HOME=/tmp/home PYTHONPATH=/tmp/home/.local/lib/python3.11/site-packages/ XDG_CONFIG_HOME=/tmp/home/.config API_PROTOCOL=http API_HOST=pulp-api API_PORT=8000 ADMIN_USERNAME=admin ADMIN_PASSWORD=$PASSWORD /tmp/home/.local/bin/pytest -o cache_dir=/tmp/home/.cache/pytest_cache -v -r sx --color=yes --pyargs pulp_service.tests.functional -m 'not parallel' --junitxml=/tmp/home/junit-pulp-serial.xml" || debug_and_fail
786933
@@ -800,6 +947,7 @@ spec:
800947 value : " $(params.SNAPSHOT)"
801948 runAfter :
802949 - pulp-functional-tests
950+ - pulp-service-functional-tests
803951 taskSpec :
804952 params :
805953 - name : BONFIRE_IMAGE
0 commit comments