Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

test: Implement End-to-End Testing for Gakimint #6

Open
19 tasks
AbdelStark opened this issue Sep 26, 2024 · 0 comments
Open
19 tasks

test: Implement End-to-End Testing for Gakimint #6

AbdelStark opened this issue Sep 26, 2024 · 0 comments

Comments

@AbdelStark
Copy link
Collaborator

Implement End-to-End Testing for Gakimint

Issue Description

We need to implement comprehensive end-to-end (E2E) testing for Gakimint. These tests should run an actual Postgres database, a mint server, use the wallet CLI for operations, and make curl requests to check various endpoints. This will ensure that all components of Gakimint work together as expected in a production-like environment.

Objectives

  1. Set up an E2E testing environment.
  2. Implement E2E tests covering key Gakimint operations.
  3. Create a separate CI workflow for E2E tests.

Tasks

  • Set up E2E testing environment:

    • Create a Docker Compose file to spin up Postgres and the Gakimint mint server.
    • Implement a test runner that can interact with the wallet CLI and make HTTP requests.
  • Implement E2E tests:

    • Test /info endpoint using curl.
    • Test /keys endpoint using curl.
    • Test /keysets endpoint using curl.
    • Test wallet creation and key generation using the CLI.
    • Test minting tokens using the CLI.
    • Test melting tokens using the CLI.
    • Test swapping tokens using the CLI.
    • Test balance checking using the CLI.
  • Create CI workflow for E2E tests:

    • Create a new GitHub Actions workflow file for E2E tests.
    • Configure the workflow to set up the required environment.
    • Run E2E tests as part of this new workflow.
  • Update documentation:

    • Document the E2E testing process.
    • Update the project README with information about E2E tests.

E2E Test Workflow

Create a new file .github/workflows/e2e_tests.yml with the following content:

name: End-to-End Tests

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  e2e_test:
    name: Run E2E Tests
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Elixir
        uses: erlef/setup-beam@v1
        with:
          elixir-version: "1.17.2"
          otp-version: "26"

      - name: Start Gakimint environment
        run: docker-compose up -d

      - name: Wait for services to be ready
        run: |
          ./scripts/wait-for-it.sh localhost:4000 -t 60
          ./scripts/wait-for-it.sh localhost:5432 -t 60

      - name: Run E2E tests
        run: mix test.e2e

      - name: Stop Gakimint environment
        run: docker-compose down

Considerations

  • Isolation: Ensure that E2E tests don't interfere with each other or with the development environment.
  • Performance: E2E tests might take longer to run than unit tests. Consider running them less frequently or in parallel.
  • Maintainability: Structure E2E tests in a way that makes them easy to update as the application evolves.

Acceptance Criteria

  • A complete suite of E2E tests covering all major Gakimint operations is implemented.
  • E2E tests run successfully in a CI environment.
  • E2E tests use an actual Postgres database and a running mint server.
  • The wallet CLI is used for operations in the E2E tests.
  • Curl requests are used to test HTTP endpoints.
  • A separate CI workflow for E2E tests is created and runs successfully.
  • Documentation for running and maintaining E2E tests is provided.

Estimated Effort

Medium to High: Setting up a comprehensive E2E testing suite requires careful planning and implementation.

Priority

High: E2E tests are crucial for ensuring the overall functionality and reliability of Gakimint in a production-like environment.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant