Skip to content

Commit

Permalink
tmp integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
aomegax committed Jan 9, 2024
1 parent 1b38527 commit a793108
Show file tree
Hide file tree
Showing 19 changed files with 621 additions and 159 deletions.
38 changes: 38 additions & 0 deletions integration-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM python:3.11 as build
#-slim as build

ARG SHELL="/bin/sh"
ARG ALLURE_RELEASE=2.21.0
ARG ALLURE_REPO=https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline
ARG UID=1000
ARG GID=1000

ENV ROOT=/app

COPY ./ $ROOT

WORKDIR $ROOT

RUN apt-get update \
&& apt-get -y install libpq-dev gcc default-jdk\
&& pip install -r requirements.txt

RUN curl ${ALLURE_REPO}/${ALLURE_RELEASE}/allure-commandline-${ALLURE_RELEASE}.zip -L -o /tmp/allure-commandline.zip && \
unzip -q /tmp/allure-commandline.zip -d /

RUN groupadd --gid ${GID} allure \
&& useradd --uid ${UID} --gid allure --shell /bin/bash --create-home allure

ENV ALLURE_HOME=/allure-$ALLURE_RELEASE
ENV ALLURE_HOME_SL=/allure
ENV PATH=$PATH:$ALLURE_HOME/bin
ENV ALLURE_RESOURCES=$ROOT/resources

FROM build as execution

ENV PSP_SUBSCRIPTION_KEY "AT_RUNTIME"
ENV ORG_SUBSCRIPTION_KEY "AT_RUNTIME"
ENV TAGS "runnable"
ENV ENV "dev"

CMD ["sh", "run_test.sh"]
23 changes: 0 additions & 23 deletions integration-test/README.md

This file was deleted.

10 changes: 10 additions & 0 deletions integration-test/behave.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[behave]
paths=features
;show_timings = false
;show_skipped = false
;stop = false
log_capture = true
logging_event = INFO

[behave.formatters]
;html = behave_html_formatter:HTMLFormatter
25 changes: 25 additions & 0 deletions integration-test/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"_comment": "this file should be generated by test caller in order to configure systems and variables environment",
"services": {
"node-psp": {
"url": "https://api.dev.platform.pagopa.it/nodo/node-for-psp/v1",
"healthcheck": "/info",
"subscription_key": ""
},
"fdr-org": {
"url": "https://api.dev.platform.pagopa.it/fdr-org/service/v1",
"healthcheck": "/info",
"subscription_key": "ORG_SUBSCRIPTION_KEY"
}
},
"global_configuration": {
"psp": "60000000001",
"channel": "15376371009_04",
"channel_password": "PLACEHOLDER",
"organization": "15376371009",
"broker_org": "15376371009",
"broker_psp": "60000000001",
"station": "15376371009_03",
"station_password": "PLACEHOLDER"
}
}
23 changes: 23 additions & 0 deletions integration-test/environment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import json
import os
import logging

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


def before_all(context):
# initialize precondition cache to avoid check systems up for each scenario
context.precondition_cache = set()

context.config.setup_logging()

logging.debug('Global settings: loading configuration')

more_userdata = json.load(open(os.path.join(context.config.base_dir + "/config/config.json")))
for key, cfg in more_userdata.get("services").items():
if cfg.get("subscription_key") is not None:
cfg["subscription_key"] = os.getenv(cfg["subscription_key"])

context.config.update_userdata(more_userdata)

11 changes: 11 additions & 0 deletions integration-test/features/verify_ko.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Verify ko of payments
# Execute a verifyPaymentNotice to not-responding station

Background:
Given systems up

@runnable
Scenario: Send verifyPaymentNotice
Given an unique FdR name named flow_name
When PSP sends create request to fdr-microservice with payload
Then PSP receives the HTTP status code 201 to create request
Binary file added integration-test/requirements.txt
Binary file not shown.
40 changes: 40 additions & 0 deletions integration-test/run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh

if [ -z $ENV ]
then
echo "DEV environment..."
else
echo "Setting $ENV environment..."
cp config/config.json config/config.json.orig
dest="api.${ENV}."
sed "s/api.dev./$dest/g" config/config.json > config/config.json.bkp
sleep 1
mv config/config.json.bkp config/config.json
sleep 1
fi

if [ -z $TAGS ]
then
TAGS="runnable"
fi

if [ -z $JUNIT ]
then
junit=""
else
junit="--junit-directory=junit --junit"
fi

echo "Run test ..."
rm -rf results junit

behave --format allure_behave.formatter:AllureFormatter -o results $junit --tags=$TAGS --summary --show-timings -v

rm -rf results/history && cp -R reports/history results/history 2>/dev/null

allure generate results -o reports --clean

if ! [ -z $ENV ]
then
mv config/config.json.orig config/config.json
fi
1 change: 0 additions & 1 deletion integration-test/src/config/.env.dev

This file was deleted.

1 change: 0 additions & 1 deletion integration-test/src/config/.env.local

This file was deleted.

1 change: 0 additions & 1 deletion integration-test/src/config/.env.prod

This file was deleted.

1 change: 0 additions & 1 deletion integration-test/src/config/.env.uat

This file was deleted.

16 changes: 0 additions & 16 deletions integration-test/src/features/example.feature

This file was deleted.

19 changes: 0 additions & 19 deletions integration-test/src/package.json

This file was deleted.

64 changes: 0 additions & 64 deletions integration-test/src/step_definitions/support/common.js

This file was deleted.

31 changes: 0 additions & 31 deletions integration-test/src/step_definitions/support/steps.js

This file was deleted.

Loading

0 comments on commit a793108

Please sign in to comment.