tests: add functionnal tests (e2e if you will)

This commit is contained in:
Romain Bertrand 2025-12-16 10:45:29 +01:00
parent f3cc8bdb10
commit 9174e537b6
4 changed files with 414 additions and 1 deletions

View file

@ -0,0 +1,38 @@
# Functional Tests
End-to-end tests that make real API calls to a Codeberg instance.
## Running Tests
These tests require special setup and credentials. See [SETUP_FUNCTIONAL_TESTS.md](../../SETUP_FUNCTIONAL_TESTS.md) for complete instructions.
### Quick Start
```bash
export CODEBERG_TEST_TOKEN="your_token"
export CODEBERG_TEST_OWNER="test-account-username"
export CODEBERG_TEST_REPO="test-repo-name"
go test -v -race -tags=functional ./...
```
### What They Test
- ✅ API authentication and connectivity
- ✅ Repository listing and details
- ✅ Issue creation, listing, retrieval
- ✅ Issue comments
- ✅ API error handling
- ✅ Repository secrets and actions (if available)
### CI Integration
These tests run automatically in CI when configured:
- Only on `main` branch and pull requests
- Requires `CODEBERG_TEST_TOKEN` secret and configuration variables
- Uses a dedicated test account (not your personal account)
### Files
- `functional_test.go` - Test suite with all test cases
- `fixtures.go` - Helper functions and test environment setup