diff --git a/.github/workflows/unit-test-abci.yml b/.github/workflows/unit-test-abci.yml new file mode 100644 index 0000000..3237d51 --- /dev/null +++ b/.github/workflows/unit-test-abci.yml @@ -0,0 +1,59 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +name: Unit tests +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Build container + run: | + docker-compose -f docker-compose.yml build --no-cache --build-arg abci_status=enable planetmint + + - name: Save image + run: docker save -o planetmint.tar planetmint_planetmint + + - name: Upload image + uses: actions/upload-artifact@v3 + with: + name: planetmint-abci + path: planetmint.tar + retention-days: 5 + + + test-with-abci: + runs-on: ubuntu-latest + needs: build + strategy: + matrix: + include: + - db: "Tarantool with ABCI" + host: "tarantool" + port: 3303 + abci: "enabled" + + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Download planetmint + uses: actions/download-artifact@v3 + with: + name: planetmint-abci + + - name: Load planetmint + run: docker load -i planetmint.tar + + - name: Start containers + run: docker-compose -f docker-compose.yml up -d planetmint + + - name: Run tests + run: docker exec planetmint_planetmint_1 pytest -v -m abci diff --git a/.github/workflows/unit-test-no-abci.yml b/.github/workflows/unit-test-no-abci.yml new file mode 100644 index 0000000..5b637aa --- /dev/null +++ b/.github/workflows/unit-test-no-abci.yml @@ -0,0 +1,60 @@ +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +name: Unit tests +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Build container + run: | + docker-compose -f docker-compose.yml build --no-cache planetmint + + - name: Save image + run: docker save -o planetmint.tar planetmint_planetmint + + - name: Upload image + uses: actions/upload-artifact@v3 + with: + name: planetmint + path: planetmint.tar + retention-days: 5 + + + test-without-abci: + runs-on: ubuntu-latest + needs: build + strategy: + matrix: + include: + - db: "Tarantool without ABCI" + host: "tarantool" + port: 3303 + + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Download planetmint + uses: actions/download-artifact@v3 + with: + name: planetmint + + - name: Load planetmint + run: docker load -i planetmint.tar + + - name: Start containers + run: docker-compose -f docker-compose.yml up -d bdb + + - name: Run tests + run: docker exec planetmint_planetmint_1 pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml + + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v3 \ No newline at end of file diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml deleted file mode 100644 index 133b1c0..0000000 --- a/.github/workflows/unit-test.yml +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright © 2020 Interplanetary Database Association e.V., -# Planetmint and IPDB software contributors. -# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) -# Code is Apache-2.0 and docs are CC-BY-4.0 - -name: Unit tests -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - abci_enabled: "ABCI enabled" - abci: "enabled" - - abci_disabled: "ABCI disabled" - abci: "disabled" - - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Build container - run: | - if [[ "${{ matrix.abci }}" == "enabled" ]]; then - docker-compose -f docker-compose.yml build --no-cache --build-arg abci_status=enable planetmint - fi - if [[ ""${{ matrix.abci }}" == "disabled"" ]]; then - docker-compose -f docker-compose.yml build --no-cache planetmint - fi - - - name: Save image - run: docker save -o planetmint.tar planetmint_planetmint - - - name: Upload image - uses: actions/upload-artifact@v3 - with: - name: planetmint-abci-${{matrix.abci}} - path: planetmint.tar - retention-days: 5 - - - test-with-abci: - runs-on: ubuntu-latest - needs: build - strategy: - matrix: - include: - #- db: "MongoDB with ABCI" - # host: "mongodb" - # port: 27017 - # abci: "enabled" - - db: "Tarantool with ABCI" - host: "tarantool" - port: 3303 - abci: "enabled" - - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Download planetmint - uses: actions/download-artifact@v3 - with: - name: planetmint-abci-enabled - - - name: Load planetmint - run: docker load -i planetmint.tar - - - name: Start containers - run: docker-compose -f docker-compose.yml up -d planetmint - - - name: Run tests - run: docker exec planetmint_planetmint_1 pytest -v -m abci - - test-without-abci: - runs-on: ubuntu-latest - needs: build - strategy: - matrix: - include: - #- db: "MongoDB without ABCI" - # host: "mongodb" - # port: 27017 - - db: "Tarantool without ABCI" - host: "tarantool" - port: 3303 - - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Download planetmint - uses: actions/download-artifact@v3 - with: - name: planetmint-abci-disabled - - - name: Load planetmint - run: docker load -i planetmint.tar - - - name: Start containers - run: docker-compose -f docker-compose.yml up -d bdb - - - name: Run tests - run: docker exec planetmint_planetmint_1 pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml - - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v3 \ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index f24db27..3e76eb4 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -51,11 +51,7 @@ def test_bigchain_class_default_initialization(config): @pytest.mark.bdb def test_get_spent_issue_1271(b, alice, bob, carol): - from planetmint import Planetmint - connection = Connection() - del connection - planet = Planetmint() - print(f" CONNECTION HOST : {planet.connection.host}") + tx_1 = Create.generate( [carol.public_key], [([carol.public_key], 8)],