test(e2e): introduce e2e test framework with local forgejo

This commit is contained in:
Julian Tölle 2025-06-15 16:29:30 +02:00
parent 6ed133946e
commit af70a267f5
4 changed files with 221 additions and 0 deletions

View file

@ -0,0 +1,39 @@
//go:build e2e_forgejo
package forgejo
import (
"context"
"os"
"testing"
"github.com/stretchr/testify/require"
)
func TestMain(m *testing.M) {
ctx := context.Background()
suffix := randomSuffix()
TestToken = setupTestUser(ctx, suffix)
TestClient = setupTestClient(ctx, TestToken)
os.Exit(m.Run())
}
func TestAPIAccess(t *testing.T) {
user, _, err := TestClient.GetMyUserInfo()
require.NoError(t, err)
require.NotNil(t, user)
}
func TestCreateRepository(t *testing.T) {
_ = NewRepository(t, t.Name())
}
func TestRun(t *testing.T) {
repo := NewRepository(t, t.Name())
MustRun(t, repo, []string{})
}