Commit fef258bd authored by Pavel Kuzmenko's avatar Pavel Kuzmenko
Browse files

feat: add matrix CI run test

parent e2152700
[flake8]
max-line-length = 120
\ No newline at end of file
max-line-length = 120
ignore = D, F, E, W
\ No newline at end of file
......@@ -10,7 +10,7 @@ image: registry-gitlab.prozorro.sale/prozorro-sale/ci-build-box
variables:
PROZORRO_FUNCTIONAL_TESTS_IMAGE_FULL_NAME: registry-gitlab.prozorro.sale/prozorro-sale/functional-tests
PROZORRO_FUNCTIONAL_TESTS_IMAGE: "prozorro_sale/functional"
PROZORRO_FUNCTIONAL_TESTS_IMAGE: $CI_PROJECT_PATH_SLUG$CI_PIPELINE_ID
TAG: $CI_COMMIT_SHORT_SHA
......@@ -26,22 +26,10 @@ build-new-image:
tags:
- kube
script:
- make build
- make docker-build
#test-run:
# stage: test-run
# variables:
# AUTHORIZATION_TOKEN: auction_token
# BASE_API_URL: https://procedure-dev.prozorro.sale
# BASE_AUCTION_API_URL: https://auction-dev.prozorro.sale
# tags:
# - kube
# script:
# - make run
test-run_basicSell:
test-procedures:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
......@@ -50,10 +38,25 @@ test-run_basicSell:
tags:
- kube
script:
- make run_basicSell
test-run_commercialSell:
- make test-procedures
parallel:
matrix:
- TEST_PROCEDURES: [
BSD,
BSE,
CSD,
CSE,
CSI,
LLD,
LLE,
LLP,
SUD,
SUE,
TIE,
REFACTOR
]
test-services:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
......@@ -62,80 +65,12 @@ test-run_commercialSell:
tags:
- kube
script:
- make run_commercialSell
test-run_document_service:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
BASE_API_URL: https://procedure-dev.prozorro.sale
BASE_AUCTION_API_URL: https://auction-dev.prozorro.sale
tags:
- kube
script:
- make run_document_service
test-run_legitimatePropertyLease:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
BASE_API_URL: https://procedure-dev.prozorro.sale
BASE_AUCTION_API_URL: https://auction-dev.prozorro.sale
tags:
- kube
script:
- make run_legitimatePropertyLease
test-run_railway:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
BASE_API_URL: https://procedure-dev.prozorro.sale
BASE_AUCTION_API_URL: https://auction-dev.prozorro.sale
tags:
- kube
script:
- make run_railway
test-run_renewables:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
BASE_API_URL: https://procedure-dev.prozorro.sale
BASE_AUCTION_API_URL: https://auction-dev.prozorro.sale
tags:
- kube
script:
- make run_renewables
test-run_subsoil:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
BASE_API_URL: https://procedure-dev.prozorro.sale
BASE_AUCTION_API_URL: https://auction-dev.prozorro.sale
tags:
- kube
script:
- make run_subsoil
test-run_timber:
stage: test-run
variables:
AUTHORIZATION_TOKEN: auction_token
BASE_API_URL: https://procedure-dev.prozorro.sale
BASE_AUCTION_API_URL: https://auction-dev.prozorro.sale
tags:
- kube
script:
- make run_timber
- make test-services
parallel:
matrix:
- TEST_SERVICES: [
document_service,
]
push-to-registry:
stage: publish
......
......@@ -4,52 +4,37 @@ TAG ?= develop
BASE_API_URL ?= https://procedure-dev.prozorro.sale
BASE_AUCTION_API_URL ?= https://auction-dev.prozorro.sale
TEST_PROCEDURES ?= BSD BSE CSD CSE CSI LLD LLE LLP SUD SUE TIE REFACTOR
TEST_SERVICES ?= document_service
.EXPORT_ALL_VARIABLES:
ifdef CI
REBUILD_IMAGES_FOR_TESTS =
else
REBUILD_IMAGES_FOR_TESTS = docker-build
endif
TEST_PATH ?= test_scenarios
PYTEST_OPTIONS ?= -vrfE -n 4 -W ignore::DeprecationWarning
.default: run
#run:
# docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
# --rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)
run_basicSell:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_basicSell_procedure.py
run_commercialSell:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_commercialSell_procedure.py
run_document_service:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_document_service.py
.EXPORT_ALL_VARIABLES:
run_legitimatePropertyLease:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_legitimatePropertyLease_procedure.py
.default: run
run_railway:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_railway_procedure.py
run: test-procedures test-services
run_renewables:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_renewables_procedure.py
run_subsoil:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_subsoil_procedure.py
test-procedures: $(REBUILD_IMAGES_FOR_TESTS)
@$(foreach var,$(TEST_PROCEDURES), echo "\n\n======= Check $(var) =======\n\n" \
&& docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(TEST_PATH)/procedures/$(var) || exit;)
run_timber:
docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(PYTEST_OPTIONS) $(TEST_PATH)/test_timber_procedure.py
test-services: $(REBUILD_IMAGES_FOR_TESTS)
@$(foreach var,$(TEST_SERVICES), echo "\n\n======= Check $(var) =======\n\n" \
&& docker run -e "BASE_API_URL=$(BASE_API_URL)" -e "BASE_AUCTION_API_URL=$(BASE_AUCTION_API_URL)" \
--rm $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) $(TEST_PATH)/services/$(var) || exit;)
build:
docker-build:
docker build -t $(PROZORRO_FUNCTIONAL_TESTS_IMAGE):$(TAG) .
version:
......
......@@ -10,22 +10,47 @@ make build
#### 2. Run tests of the specific environment
Example for run BSE procedure test on dev
```bash
make run-{evironment name}
export BASE_API_URL=https://procedure-dev.prozorro.sale
export BASE_AUCTION_API_URL=https://auction-dev.prozorro.sale
export TEST_PROCEDURES=BSE
make test-procedures
```
#### or
Example for run BSE procedure test on dev
```bash
export BASE_API_URL=https://procedure-dev.prozorro.sale
export BASE_AUCTION_API_URL=https://auction-dev.prozorro.sale
export TEST_SERVICES=document_service
make test-services
```
#### or
Example for run all procedure and services test on dev
```bash
make run
```
#### for running test of the dev environment in the interactive mode
## Existing environments
## Existing procedures tests
* dev
* BSD
* BSE
* CSD
* CSE
* CSI
* LLD
* LLE
* LLP
* SUD
* SUE
* TIE
* staging
## Existing services tests
* sandbox
* document_service
\ No newline at end of file
[pytest]
addopts = -vrfE -n 4
asyncio_mode = auto
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
......
......@@ -129,7 +129,6 @@ def create_renewables_procedure_data():
return deepcopy(RENEWABLES_PROCEDURE_DATA)
@pytest.mark.asyncio
@pytest.fixture
async def renewables_procedure(procedure_api, create_renewables_procedure_data):
"""
......@@ -170,7 +169,6 @@ def create_renewables_initial_qualification_data():
@pytest.fixture
@pytest.mark.asyncio
async def renewables_procedure_initial_qualification(client, create_renewables_initial_qualification_data):
"""
Fixture to create procedure renewables-initial-qualification from prepared data
......@@ -202,7 +200,6 @@ def create_procedure_subsoil_initial_qualification_data():
@pytest.fixture
@pytest.mark.asyncio
async def subsoil_procedure_initial_qualification(client, create_procedure_subsoil_initial_qualification_data):
"""
Fixture to create procedure subsoil-initial-qualification from prepared data
......@@ -224,7 +221,6 @@ async def subsoil_procedure_initial_qualification(client, create_procedure_subso
@pytest.fixture
@pytest.mark.asyncio
async def renewables_initial_qualification_equal_bids(client, create_renewables_initial_qualification_data):
"""
Fixture to create procedure renewables-initial-qualification from prepared data
......@@ -257,7 +253,6 @@ async def renewables_initial_qualification_equal_bids(client, create_renewables_
@pytest.fixture
@pytest.mark.asyncio
async def renewables_initial_qualification_org_quantity_greater_than_bids(
client,
create_renewables_initial_qualification_data
......@@ -281,7 +276,6 @@ async def renewables_initial_qualification_org_quantity_greater_than_bids(
@pytest.fixture
@pytest.mark.asyncio
async def renewables_initial_qualification_with_bid_doc(
procedure_api,
create_renewables_initial_qualification_data,
......@@ -309,7 +303,6 @@ async def renewables_initial_qualification_with_bid_doc(
@pytest.fixture
@pytest.mark.asyncio
async def renewables_initial_qualification_fast(client, create_renewables_initial_qualification_data):
"""
Fixture to create procedure renewables-initial-qualification-fast from prepared data
......@@ -335,7 +328,6 @@ def create_procedure_railway_initial_qualification_data():
@pytest.fixture
@pytest.mark.asyncio
async def railway_procedure_initial_qualification(client, create_procedure_railway_initial_qualification_data):
"""
Fixture to create procedure railwayCargoEnglish-initial-qualification from prepared data
......
import datetime
import asyncio
import pytest
import iso8601
import datetime
import os
import iso8601
import pytest
from helpers.auction import post_auction_bid
from helpers.procedure import change_status_to_active_tendering, get_procedure_data
from settings import (
ENGLISH_AUCTION_FAST_ROUND_DURATION, ENGLISH_AUCTION_ROUNDS_QUANTITY,
ENGLISH_AUCTION_PRE_ROUND_DURATION, INITIAL_QUALIFICATION_BIDS
)
from helpers.procedure import change_status_to_active_tendering, get_procedure_data
from helpers.auction import post_auction_bid
FIXTURE_PROCEDURE_ENGLISH = os.path.join('basicSell', 'english', 'procedure.json')
FIXTURE_PROCEDURE_DUTCH = os.path.join('basicSell', 'dutch', 'procedure.json')
FIXTURE_BID = os.path.join('basicSell', 'english', 'bid.json')
......@@ -45,7 +44,6 @@ def bid_data(get_fixture_by_name):
return get_fixture_by_name(FIXTURE_BID)
@pytest.mark.asyncio
@pytest.fixture
async def procedure(procedure_api, create_procedure_data, technicalSpecifications_doc_data_public):
"""
......@@ -65,7 +63,6 @@ async def procedure(procedure_api, create_procedure_data, technicalSpecification
return {'procedure_id': data['id'], 'acc_token': data['acc_token']}
@pytest.mark.asyncio
@pytest.fixture
async def procedure_dutch(procedure_api, create_procedure_data_dutch, technicalSpecifications_doc_data_public):
"""
......@@ -86,7 +83,6 @@ async def procedure_dutch(procedure_api, create_procedure_data_dutch, technicalS
@pytest.fixture
@pytest.mark.asyncio
async def procedure_fast(procedure_api, create_procedure_data, technicalSpecifications_doc_data_public):
"""
Fixture to create procedure_fast from prepared data (create_procedure_data fixture)
......@@ -109,7 +105,6 @@ async def procedure_fast(procedure_api, create_procedure_data, technicalSpecific
return {'procedure_id': data['id'], 'acc_token': data['acc_token']}
@pytest.mark.asyncio
@pytest.fixture
async def procedure_initial_qualification(
procedure_api, create_procedure_data, technicalSpecifications_doc_data_public, bids
......@@ -153,7 +148,6 @@ class TestProcedureToEnglishAuction:
up to 'qualification'.
Check bid posting to auction module directly.
"""
@pytest.mark.asyncio
async def test_auction_starts_flow(self, procedure_api, bid_api, procedure_fast, bid_data):
data = await get_procedure_data(procedure_api, procedure_fast['procedure_id'])
tendering_to_auction_timeout = (
......@@ -209,7 +203,6 @@ class TestProcedureToEnglishAuction:
assert auction_bid_1 == data['awards'][1]['value']['amount']
assert auction_bid_2 == data['awards'][0]['value']['amount']
@pytest.mark.asyncio
async def test_auction_initial_bids_on_qualification_start(
self,
procedure_api,
......@@ -258,7 +251,6 @@ class TestProcedureToEnglishAuction:
class TestProcedureActiveQualification:
@pytest.mark.asyncio
async def test_qualification_awards_created(
self,
procedure_api,
......@@ -272,7 +264,6 @@ class TestProcedureActiveQualification:
assert data['awards'][0]['status'] == 'pending'
assert data['awards'][1]['status'] == 'pending_waiting'
@pytest.mark.asyncio
async def test_activation_pending_award(
self,
procedure_api,
......@@ -307,7 +298,6 @@ class TestProcedureActiveQualification:
assert data['status'] == 'active_awarded'
assert data['contracts'][0]['status'] == 'pending'
@pytest.mark.asyncio
async def test_disqualification_pending_award(
self,
procedure_api,
......@@ -345,7 +335,6 @@ class TestProcedureActiveQualification:
assert award_2['status'] == 'pending'
assert data['status'] == 'active_qualification'
@pytest.mark.asyncio
async def test_self_cancellation_challenger_award(
self,
procedure_api,
......@@ -377,7 +366,6 @@ class TestProcedureActiveQualification:
class TestProcedureActiveAwarded:
# TODO {"status": "Status signed can not be set"}
@pytest.mark.asyncio
@pytest.mark.skip
async def test_sign_contract(
self,
......@@ -435,7 +423,6 @@ class TestProcedureActiveAwarded:
assert data['contracts'][0]['status'] == 'signed'
assert data['status'] == 'pending_payment'
@pytest.mark.asyncio
async def test_disqualification_active_award_and_reset_qualification(
self,
procedure_api,
......@@ -489,7 +476,6 @@ class TestProcedureActiveAwarded:
assert data['status'] == 'active_qualification'
assert data['contracts'][0]['status'] == 'cancelled'
@pytest.mark.asyncio
async def test_self_cancellation_challenger_award_in_active_awarded(
self,
procedure_api,
......@@ -533,7 +519,6 @@ class TestProcedureActiveAwarded:
assert award_2['status'] == 'cancelled'
assert data['status'] == 'active_awarded'
# class TestProcedurePayment:
#
# @pytest.mark.asyncio
......
import datetime
import asyncio
import pytest
import iso8601
import datetime
import os
import iso8601
import pytest
from helpers.auction import post_auction_bid
from helpers.procedure import change_status_to_active_tendering, get_procedure_data
from settings import (
ENGLISH_AUCTION_FAST_ROUND_DURATION, ENGLISH_AUCTION_ROUNDS_QUANTITY,
ENGLISH_AUCTION_PRE_ROUND_DURATION, INITIAL_QUALIFICATION_BIDS
)
from helpers.procedure import change_status_to_active_tendering, get_procedure_data
from helpers.auction import post_auction_bid
FIXTURE_PROCEDURE_INFINITY = os.path.join('commercialSell', 'infinity', 'procedure.json')
FIXTURE_PROCEDURE_ENGLISH = os.path.join('commercialSell', 'english', 'procedure.json')
......@@ -54,7 +54,6 @@ def bid_data(get_fixture_by_name):
return get_fixture_by_name(FIXTURE_BID)
@pytest.mark.asyncio
@pytest.fixture
async def procedure(procedure_api, create_procedure_data, illustration_doc_data_public):
"""
......@@ -74,7 +73,6 @@ async def procedure(procedure_api, create_procedure_data, illustration_doc_data_
return {'procedure_id': data['id'], 'acc_token': data['acc_token']}
@pytest.mark.asyncio
@pytest.fixture
async def procedure_dutch(procedure_api, create_procedure_data_dutch, illustration_doc_data_public):
"""
......@@ -94,7 +92,6 @@ async def procedure_dutch(procedure_api, create_procedure_data_dutch, illustrati
return {'procedure_id': data['id'], 'acc_token': data['acc_token']}
@pytest.mark.asyncio
@pytest.fixture
async def procedure_infinity(procedure_api, create_procedure_data_infinity, illustration_doc_data_public):
"""
......@@ -115,7 +112,6 @@ async def procedure_infinity(procedure_api, create_procedure_data_infinity, illu
@pytest.fixture
@pytest.mark.asyncio
async def procedure_fast(procedure_api, create_procedure_data, illustration_doc_data_public):
"""
Fixture to create procedure_fast from prepared data (create_procedure_data fixture)
......@@ -138,7 +134,6 @@ async def procedure_fast(procedure_api, create_procedure_data, illustration_doc_
return {'procedure_id': data['id'], 'acc_token': data['acc_token']}
@pytest.mark.asyncio
@pytest.fixture
async def procedure_initial_qualification(procedure_api, create_procedure_data, illustration_doc_data_public, bids):
"""
......@@ -184,7 +179,6 @@ class TestProcedureToEnglishAuction:
up to 'qualification'.
Check bid posting to auction module directly.
"""
@pytest.mark.asyncio
async def test_auction_starts_flow(self, procedure_api, bid_api, procedure_fast, bid_data):
data = await get_procedure_data(procedure_api, procedure_fast['procedure_id'])
tendering_to_auction_timeout = (
......@@ -240,7 +234,6 @@ class TestProcedureToEnglishAuction:
assert auction_bid_1 == data['awards'][1]['value']['amount']
assert auction_bid_2 == data['awards'][0]['value']['amount']
@pytest.mark.asyncio
async def test_auction_initial_bids_on_qualification_start(
self,
procedure_api,
......@@ -289,7 +282,6 @@ class TestProcedureToEnglishAuction:
class TestProcedureActiveQualification:
@pytest.mark.asyncio
async def test_qualification_awards_created(
self,
procedure_api,
......@@ -303,7 +295,6 @@ class TestProcedureActiveQualification:
assert data['awards'][0]['status'] == 'pending'
assert data['awards'][1]['status'] == 'pending_waiting'
@pytest.mark.asyncio
async def test_activation_pending_award(
self,
procedure_api,
......@@ -338,7 +329,6 @@ class TestProcedureActiveQualification:
assert data['status'] == 'active_awarded'
assert data['contracts'][0]['status'] == 'pending'
@pytest.mark.asyncio
async def test_disqualification_pending_award(
self,
procedure_api,
......@@ -376,7 +366,6 @@ class TestProcedureActiveQualification:
assert award_2['status'] == 'pending'
assert data['status'] == 'active_qualification'
@pytest.mark.asyncio
async def test_self_cancellation_challenger_award(
self,
procedure_api,
......@@ -407,7 +396,6 @@ class TestProcedureActiveQualification:
class TestProcedureActiveAwarded:
# TODO {"status": "Status signed can not be set"}
@pytest.mark.asyncio
@pytest.mark.skip
async def test_sign_contract(
self,
......@@ -465,7 +453,6 @@ class TestProcedureActiveAwarded:
assert data['contracts'][0]['status'] == 'signed'
assert data['status'] == 'pending_payment'
@pytest.mark.asyncio
async def test_disqualification_active_award_and_reset_qualification(
self,
procedure_api,
......@@ -519,7 +506,6 @@ class TestProcedureActiveAwarded:
assert data['status'] == 'active_qualification'
assert data['contracts'][0]['status'] == 'cancelled'
@pytest.mark.asyncio
async def test_self_cancellation_challenger_award_in_active_awarded(
self,
procedure_api,
......@@ -563,7 +549,6 @@ class TestProcedureActiveAwarded:
assert award_2['status'] == 'cancelled'
assert data['status'] == 'active_awarded'
# class TestProcedurePayment:
#
# @pytest.mark.asyncio
......