diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 064e6d95..4842a0c3 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -72,6 +72,12 @@ the following variables to your needs: | Test team (this is an ordinary group in GitLab) | fluxcd-testing-2 | `GITLAB_TEST_TEAM_NAME` | | Test user | fluxcd-gitprovider-bot | `GIT_PROVIDER_USER` | +After the tests have finished, you can stop the ephemeral GitLab instance with: + +``` +make stop-provider-instances +``` + #### Stash ``` @@ -98,9 +104,12 @@ make start-provider-instances-gitea As soon as the containers are up and Gitea is running, execute the tests: ``` +export GITEA_TOKEN=$(cat /tmp/gitea-token) make test-e2e-gitea ``` +The gitea token is stored in `/tmp/gitea-token` and is by the makefile. + The Make target automatically runs the tests against the ephemeral instance. To change the test configuration, adjust the following variables to your needs: @@ -111,6 +120,12 @@ the following variables to your needs: | Test team (this is an ordinary group in GitLab) | fluxcd-testing-2 | `GITEA_TEST_TEAM_NAME` | | Test user | fluxcd-gitprovider-bot | `GITEA_USER` | +After the tests have finished, you can stop the ephemeral Gitea instance with: + +``` +make stop-provider-instances +``` + ## Continuous Integration The e2e test suite runs in GitHub Actions on each commit to the main branch and on branches pushed to the repository, i.e. on PRs created from people with write access. diff --git a/Makefile b/Makefile index b75fdd1d..c613e65f 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ GITLAB_TEST_SUBGROUP ?= fluxcd-testing-sub-group GITLAB_TEST_TEAM_NAME ?= fluxcd-testing-2 # Gitea specific testing variables -GITEA_USER_UID ?= 1000 GITEA_BASE_URL ?= http://127.0.0.1:3000 GITEA_TOKEN ?= not-set GITEA_TEST_TEAM_NAME ?= fluxcd-testing-2 diff --git a/docker-compose.yml b/docker-compose.yml index 41e6db49..2d4c440b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: ports: - 3000:3000 environment: - - USER_UID=${GITEA_USER_UID:-1000} + - USER_UID=1000 - USER_GID=1000 - GITEA__security__INSTALL_LOCK=${GITEA_INSTALL_LOCK:-true} - GIT_PROVIDER_ORGANIZATION=$GIT_PROVIDER_ORGANIZATION diff --git a/gitea/client_repository_pullrequest.go b/gitea/client_repository_pullrequest.go index 88d66abd..dc665805 100644 --- a/gitea/client_repository_pullrequest.go +++ b/gitea/client_repository_pullrequest.go @@ -89,7 +89,7 @@ func (c *PullRequestClient) Edit(ctx context.Context, number int, opts gitprovid } // Merge merges a pull request with the given specifications. -// Supported merge methods are: MergeMethodMerge, MergeMethodRebase, MergeMethodSquash +// Supported merge methods are: MergeMethodMerge and MergeMethodSquash func (c *PullRequestClient) Merge(ctx context.Context, number int, mergeMethod gitprovider.MergeMethod, message string) error { mergeOpts := gitea.MergePullRequestOption{ Style: gitea.MergeStyle(mergeMethod), diff --git a/gitea/giteaclient.go b/gitea/giteaclient.go index 18ad22a5..7c2865d5 100644 --- a/gitea/giteaclient.go +++ b/gitea/giteaclient.go @@ -24,9 +24,8 @@ import ( "github.com/fluxcd/go-git-providers/gitprovider" ) -// giteaClientImpl is a wrapper around *gitea.Client, which implements higher-level methods, -// operating on the gitea structs. TODO: Verify pagination is implemented for all List* methods, -// all returned objects are validated, and HTTP errors are handled/wrapped using handleHTTPError. +// giteaClient is a wrapper around *gitea.Client, which implements higher-level methods, +// operating on the gitea structs. // This interface is also fakeable, in order to unit-test the client. type giteaClient interface { // Client returns the underlying *gitea.Client diff --git a/gitea/integration_repositories_user_test.go b/gitea/integration_repositories_user_test.go index d618efbb..a8b648b0 100644 --- a/gitea/integration_repositories_user_test.go +++ b/gitea/integration_repositories_user_test.go @@ -214,9 +214,6 @@ var _ = Describe("Gitea Provider", func() { return retryOp.IsRetryable(err, fmt.Sprintf("get commits, repository: %s", userRepo.Repository().GetRepository())) }, retryOp.Timeout(), retryOp.Interval()).Should(BeTrue()) - latestCommit := commits[0] - fmt.Println("latest commit sha: ", latestCommit.Get().Sha) - branchName := fmt.Sprintf("test-branch-%03d", rand.Intn(1000)) branchName2 := fmt.Sprintf("test-branch-%03d", rand.Intn(1000)) diff --git a/gitprovider/enums.go b/gitprovider/enums.go index f6c73c49..c5292c30 100644 --- a/gitprovider/enums.go +++ b/gitprovider/enums.go @@ -182,7 +182,4 @@ const ( // MergeMethodSquash causes a pull request merge to first squash commits MergeMethodSquash = MergeMethod("squash") - - // MergeMethodRebase causes a pull request merge to first rebase commits - MergeMethodRebase = MergeMethod("rebase") ) diff --git a/tests/gitea/await-healthy.sh b/tests/gitea/await-healthy.sh index 52d7ff07..942d8fe6 100755 --- a/tests/gitea/await-healthy.sh +++ b/tests/gitea/await-healthy.sh @@ -21,3 +21,5 @@ echo # Keep token in tmp file for later use echo $GITEA_TOKEN > /tmp/gitea-token + +echo "Gitea token saved to /tmp/gitea-token" \ No newline at end of file