From 93296305f906ad7c00cd4a2fd1d0cb3c588fe8e0 Mon Sep 17 00:00:00 2001 From: Nils Goroll Date: Mon, 27 Apr 2026 23:05:18 +0200 Subject: [PATCH] fix test: revert unneeded test change with unintended consequences (#12281) ... from #11194 / 0034e55965262692f127d53a74fc176a37f0ef46 Revert a test code change left over from an intermediate development step which is not needed, because the LFS JWT config is tested in lfs.TestAuthenticate() Fixes #12263 ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. All work and communication must conform to Forgejo's [AI Agreement](https://codeberg.org/forgejo/governance/src/branch/main/AIAgreement.md). There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests for Go changes (can be removed for JavaScript changes) - I added test coverage for Go changes... - [X] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I ran... - [X] `make pr-go` before pushing ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [X] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [X] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. *The decision if the pull request will be shown in the release notes is up to the mergers / release team.* The content of the `release-notes/.md` file will serve as the basis for the release notes. If the file does not exist, the title of the pull request will be used instead. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12281 Reviewed-by: Mathieu Fenniak --- services/repository/lfs_test.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/services/repository/lfs_test.go b/services/repository/lfs_test.go index 0224b71100..969516ef5a 100644 --- a/services/repository/lfs_test.go +++ b/services/repository/lfs_test.go @@ -15,31 +15,18 @@ import ( "forgejo.org/modules/lfs" "forgejo.org/modules/setting" "forgejo.org/modules/storage" + "forgejo.org/modules/test" repo_service "forgejo.org/services/repository" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -var ini = `[security] -INSTALL_LOCK = true -INTERNAL_TOKEN = ForgejoForgejoForgejoForgejoForgejoForgejo_ # don't use in prod -[oauth2] -JWT_SECRET = ForgejoForgejoForgejoForgejoForgejoForgejo_ # don't use in prod -[server] -LFS_START_SERVER = true -LFS_JWT_SECRET = ForgejoForgejoForgejoForgejoForgejoForgejo_ # don't use in prod - ` - func TestGarbageCollectLFSMetaObjects(t *testing.T) { - var err error - setting.CfgProvider, err = setting.NewConfigProviderFromData(ini) - require.NoError(t, err, "Config") - setting.LoadCommonSettings() - unittest.PrepareTestEnv(t) - err = storage.Init() + defer test.MockVariableValue(&setting.LFS.StartServer, true)() + err := storage.Init() require.NoError(t, err) repo, err := repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, "user2", "lfs")