Skip to content

Commit

Permalink
adressing review remarks
Browse files Browse the repository at this point in the history
Signed-off-by: Soule BA <[email protected]>
  • Loading branch information
souleb committed Jun 5, 2023
1 parent c8602a7 commit 24f103b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 12 deletions.
15 changes: 15 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand All @@ -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:

Expand All @@ -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.
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gitea/client_repository_pullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 2 additions & 3 deletions gitea/giteaclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions gitea/integration_repositories_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
3 changes: 0 additions & 3 deletions gitprovider/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
2 changes: 2 additions & 0 deletions tests/gitea/await-healthy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 24f103b

Please sign in to comment.