aboutsummaryrefslogtreecommitdiffstats
path: root/modules/test
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-06-09 16:29:29 +0800
committerGitHub <noreply@github.com>2024-06-09 16:29:29 +0800
commit6106a61eff305f0271dba54e7535fcccf14a42e0 (patch)
tree0053d92fb05ed2445c128d21fbb3c0e9d0525bab /modules/test
parent0188d82e4908eb173f7203d577f801f3168ffcb8 (diff)
downloadgitea-6106a61eff305f0271dba54e7535fcccf14a42e0.tar.gz
gitea-6106a61eff305f0271dba54e7535fcccf14a42e0.zip
Remove sub-path from container registry realm (#31293)
Container registry requires that the "/v2" must be in the root, so the sub-path in AppURL should be removed
Diffstat (limited to 'modules/test')
-rw-r--r--modules/test/utils.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/test/utils.go b/modules/test/utils.go
index 4a0c2f1b3b..8dee92fbce 100644
--- a/modules/test/utils.go
+++ b/modules/test/utils.go
@@ -34,8 +34,10 @@ func IsNormalPageCompleted(s string) bool {
return strings.Contains(s, `<footer class="page-footer"`) && strings.Contains(s, `</html>`)
}
-func MockVariableValue[T any](p *T, v T) (reset func()) {
+func MockVariableValue[T any](p *T, v ...T) (reset func()) {
old := *p
- *p = v
+ if len(v) > 0 {
+ *p = v[0]
+ }
return func() { *p = old }
}