diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index ee0b770..064e6d9 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -86,6 +86,31 @@ make test-e2e-stash | Test organization | go-git-provider-testing | `GIT_PROVIDER_ORGANIZATION` | | Test team | fluxcd-test-team | `STASH_TEST_TEAM_NAME` | + +#### Gitea + +For the Gitea tests there is automation in place to spin up an ephemeral Gitea instance to run the test suite against: + +``` +make start-provider-instances-gitea +``` + +As soon as the containers are up and Gitea is running, execute the tests: + +``` +make test-e2e-gitea +``` + +The Make target automatically runs the tests against the ephemeral instance. To change the test configuration, adjust +the following variables to your needs: + +| Setting | Default value | Environment variable | +| ----------------------------------------------- | ----------------------------- | --------------------------- | +| Access token | read from `/tmp/gitea-token` | `GITEA_TOKEN` | +| Test group | fluxcd-testing | `GIT_PROVIDER_ORGANIZATION` | +| Test team (this is an ordinary group in GitLab) | fluxcd-testing-2 | `GITEA_TEST_TEAM_NAME` | +| Test user | fluxcd-gitprovider-bot | `GITEA_USER` | + ## 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/gitea/auth.go b/gitea/auth.go index f447b75..8f8f0fa 100644 --- a/gitea/auth.go +++ b/gitea/auth.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/auth_test.go b/gitea/auth_test.go index 5e6758f..12cb8d7 100644 --- a/gitea/auth_test.go +++ b/gitea/auth_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client.go b/gitea/client.go index ec3df29..a877dff 100644 --- a/gitea/client.go +++ b/gitea/client.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_organization_teams.go b/gitea/client_organization_teams.go index f21b24f..18f494e 100644 --- a/gitea/client_organization_teams.go +++ b/gitea/client_organization_teams.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_organizations.go b/gitea/client_organizations.go index e2b4032..bd70a9f 100644 --- a/gitea/client_organizations.go +++ b/gitea/client_organizations.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repositories_org.go b/gitea/client_repositories_org.go index da4ffbc..fd0d72b 100644 --- a/gitea/client_repositories_org.go +++ b/gitea/client_repositories_org.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repositories_user.go b/gitea/client_repositories_user.go index 59863a9..98e81a5 100644 --- a/gitea/client_repositories_user.go +++ b/gitea/client_repositories_user.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repository_branch.go b/gitea/client_repository_branch.go index 9a826a3..dd4b670 100644 --- a/gitea/client_repository_branch.go +++ b/gitea/client_repository_branch.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repository_commit.go b/gitea/client_repository_commit.go index b5174e1..86fd7f5 100644 --- a/gitea/client_repository_commit.go +++ b/gitea/client_repository_commit.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repository_deploykey.go b/gitea/client_repository_deploykey.go index 9c9c87a..1c5c6b2 100644 --- a/gitea/client_repository_deploykey.go +++ b/gitea/client_repository_deploykey.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repository_file.go b/gitea/client_repository_file.go index 7258a6f..a416efd 100644 --- a/gitea/client_repository_file.go +++ b/gitea/client_repository_file.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repository_pullrequest.go b/gitea/client_repository_pullrequest.go index 6b6ee28..88d66ab 100644 --- a/gitea/client_repository_pullrequest.go +++ b/gitea/client_repository_pullrequest.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repository_teamaccess.go b/gitea/client_repository_teamaccess.go index 40c00f2..5d4750d 100644 --- a/gitea/client_repository_teamaccess.go +++ b/gitea/client_repository_teamaccess.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/client_repository_tree.go b/gitea/client_repository_tree.go index 059708b..e8b95fb 100644 --- a/gitea/client_repository_tree.go +++ b/gitea/client_repository_tree.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/example_organization_test.go b/gitea/example_organization_test.go index a947bfc..8e1847e 100644 --- a/gitea/example_organization_test.go +++ b/gitea/example_organization_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2023 The Flux CD contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package gitea_test import ( diff --git a/gitea/example_repository_test.go b/gitea/example_repository_test.go index 1c040b8..75c163e 100644 --- a/gitea/example_repository_test.go +++ b/gitea/example_repository_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2023 The Flux CD contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package gitea_test import ( diff --git a/gitea/giteaclient.go b/gitea/giteaclient.go index f70f1b3..18ad22a 100644 --- a/gitea/giteaclient.go +++ b/gitea/giteaclient.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/integration_organization_test.go b/gitea/integration_organization_test.go index 1027bc2..62ab5bc 100644 --- a/gitea/integration_organization_test.go +++ b/gitea/integration_organization_test.go @@ -1,7 +1,7 @@ //go:build e2e /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/integration_repositories_org_test.go b/gitea/integration_repositories_org_test.go index 26e3ba5..9d82ce5 100644 --- a/gitea/integration_repositories_org_test.go +++ b/gitea/integration_repositories_org_test.go @@ -1,7 +1,7 @@ //go:build e2e /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/integration_repositories_user_test.go b/gitea/integration_repositories_user_test.go index 1a8cc63..d618efb 100644 --- a/gitea/integration_repositories_user_test.go +++ b/gitea/integration_repositories_user_test.go @@ -1,7 +1,7 @@ //go:build e2e /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/integration_suite_test.go b/gitea/integration_suite_test.go index 728938e..02d1ff6 100644 --- a/gitea/integration_suite_test.go +++ b/gitea/integration_suite_test.go @@ -1,7 +1,7 @@ //go:build e2e /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/integration_team_test.go b/gitea/integration_team_test.go index c67e9a0..40d35e1 100644 --- a/gitea/integration_team_test.go +++ b/gitea/integration_team_test.go @@ -1,7 +1,7 @@ //go:build e2e /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/resource_commit.go b/gitea/resource_commit.go index 9a4a0ae..40c2293 100644 --- a/gitea/resource_commit.go +++ b/gitea/resource_commit.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/resource_deploykey.go b/gitea/resource_deploykey.go index 9429ebd..19543fd 100644 --- a/gitea/resource_deploykey.go +++ b/gitea/resource_deploykey.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/resource_organization.go b/gitea/resource_organization.go index f76cd34..6e0065d 100644 --- a/gitea/resource_organization.go +++ b/gitea/resource_organization.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -56,7 +56,6 @@ func (o *organization) APIObject() interface{} { return &o.o } - // Organization returns the organization reference. func (o *organization) Organization() gitprovider.OrganizationRef { return o.ref diff --git a/gitea/resource_pullrequest.go b/gitea/resource_pullrequest.go index b104685..5b32fbf 100644 --- a/gitea/resource_pullrequest.go +++ b/gitea/resource_pullrequest.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/resource_repository.go b/gitea/resource_repository.go index 396d897..8c01595 100644 --- a/gitea/resource_repository.go +++ b/gitea/resource_repository.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/resource_teamaccess.go b/gitea/resource_teamaccess.go index 606daab..842026f 100644 --- a/gitea/resource_teamaccess.go +++ b/gitea/resource_teamaccess.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/resource_teamaccess_test.go b/gitea/resource_teamaccess_test.go index 7df9631..003da08 100644 --- a/gitea/resource_teamaccess_test.go +++ b/gitea/resource_teamaccess_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/util.go b/gitea/util.go index 57a6d33..bbb4cb6 100644 --- a/gitea/util.go +++ b/gitea/util.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/gitea/util_test.go b/gitea/util_test.go index 86bbc59..53f239b 100644 --- a/gitea/util_test.go +++ b/gitea/util_test.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux CD contributors. +Copyright 2023 The Flux CD contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.