mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-01 15:19:09 +01:00
9b71369be9
- The action tables can become very large as it's a dumpster for every action that an user does on an repository. - The following query: `DELETE FROM action WHERE comment_id IN (SELECT id FROM comment WHERE issue_id=?)` is not using indexes for `comment_id` and is instead using an full table scan by MariaDB. - Rewriting the query to use an JOIN will allow MariaDB to use the index. - More information: https://codeberg.org/Codeberg-Infrastructure/techstack-support/issues/9 - Backport https://codeberg.org/forgejo/forgejo/pulls/1154
40 lines
1 KiB
Go
40 lines
1 KiB
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package integration
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"net/url"
|
|
"testing"
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
api "code.gitea.io/gitea/modules/structs"
|
|
"code.gitea.io/gitea/routers"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNodeinfo(t *testing.T) {
|
|
setting.Federation.Enabled = true
|
|
c = routers.NormalRoutes(context.TODO())
|
|
defer func() {
|
|
setting.Federation.Enabled = false
|
|
c = routers.NormalRoutes(context.TODO())
|
|
}()
|
|
|
|
onGiteaRun(t, func(*testing.T, *url.URL) {
|
|
req := NewRequestf(t, "GET", "/api/v1/nodeinfo")
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
VerifyJSONSchema(t, resp, "nodeinfo_2.1.json")
|
|
|
|
var nodeinfo api.NodeInfo
|
|
DecodeJSON(t, resp, &nodeinfo)
|
|
assert.True(t, nodeinfo.OpenRegistrations)
|
|
assert.Equal(t, "forgejo", nodeinfo.Software.Name)
|
|
assert.Equal(t, 25, nodeinfo.Usage.Users.Total)
|
|
assert.Equal(t, 18, nodeinfo.Usage.LocalPosts)
|
|
assert.Equal(t, 3, nodeinfo.Usage.LocalComments)
|
|
})
|
|
}
|