refactor: migrate e2e tests from efficientgo/e2e to capytest

This commit is contained in:
2025-07-05 20:31:43 +03:00
parent 5e24940ef8
commit 9d6a414a99
23 changed files with 174 additions and 319 deletions

View File

@ -21,33 +21,69 @@ package e2etests_test
import (
"testing"
"github.com/efficientgo/e2e"
"go.alt-gnome.ru/capytest"
)
func TestE2EIssue78Mirrors(t *testing.T) {
dockerMultipleRun(
t,
"issue-78-mirrors",
COMMON_SYSTEMS,
func(t *testing.T, r e2e.Runnable) {
defaultPrepare(t, r)
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git")
execShouldNoError(t, r, "sudo", "alr", "repo", "set-url", REPO_NAME_FOR_E2E_TESTS, "https://example.com")
execShouldNoError(t, r, "sudo", "alr", "ref")
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "clear", REPO_NAME_FOR_E2E_TESTS)
execShouldError(t, r, "sudo", "alr", "ref")
runMatrixSuite(t, "issue-78-mirrors", COMMON_SYSTEMS, func(t *testing.T, r capytest.Runner) {
defaultPrepare(t, r)
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git")
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "rm", "--partial", REPO_NAME_FOR_E2E_TESTS, "gitea.plemya-x.ru/Maks1mS")
execShouldError(t, r, "sudo", "alr", "ref")
r.Command("sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git").
ExpectSuccess().
Run(t)
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git")
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "rm", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git")
execShouldError(t, r, "sudo", "alr", "ref")
r.Command("sudo", "alr", "repo", "set-url", REPO_NAME_FOR_E2E_TESTS, "https://example.com").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "ref").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "repo", "mirror", "clear", REPO_NAME_FOR_E2E_TESTS).
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "ref").
ExpectFailure().
Run(t)
r.Command("sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "repo", "mirror", "rm", "--partial", REPO_NAME_FOR_E2E_TESTS, "gitea.plemya-x.ru/Maks1mS").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "ref").
ExpectFailure().
Run(t)
r.Command("sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "repo", "mirror", "rm", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "ref").
ExpectFailure().
Run(t)
r.Command("sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "repo", "mirror", "rm", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git").
ExpectSuccess().
Run(t)
r.Command("sudo", "alr", "ref").
ExpectFailure().
Run(t)
})
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "add", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git")
execShouldNoError(t, r, "sudo", "alr", "repo", "mirror", "rm", REPO_NAME_FOR_E2E_TESTS, "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git")
execShouldError(t, r, "sudo", "alr", "ref")
},
)
}