• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender-server / 1961830404

01 Aug 2025 06:29PM UTC coverage: 65.815% (+0.3%) from 65.555%
1961830404

Pull #849

gitlab-ci

web-flow
chore: bump the backend-docker-dependencies group across 10 directories with 2 updates

Bumps the backend-docker-dependencies group with 2 updates in the /backend/services/create-artifact-worker directory: golang and alpine.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deployments directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deviceauth directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deviceconfig directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/deviceconnect directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/inventory directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/iot-manager directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/reporting directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/useradm directory: golang.
Bumps the backend-docker-dependencies group with 1 update in the /backend/services/workflows directory: golang.


Updates `golang` from 1.24.4 to 1.24.5

Updates `alpine` from 3.22.0 to 3.22.1

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

Updates `golang` from 1.24.4 to 1.24.5

---
updated-dependencies:
- dependency-name: golang
  dependency-version: 1.24.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: backend-docker-dependencies
- dependency-name: alpine
  dependency-version: 3.22.1
  dependency-type: direct:production... (continued)
Pull Request #849: chore: bump the backend-docker-dependencies group across 10 directories with 2 updates

29335 of 44572 relevant lines covered (65.81%)

1.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.65
/backend/pkg/store/utils.go
1
// Copyright 2023 Northern.tech AS
2
//
3
//        Licensed under the Apache License, Version 2.0 (the "License");
4
//        you may not use this file except in compliance with the License.
5
//        You may obtain a copy of the License at
6
//
7
//            http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//        Unless required by applicable law or agreed to in writing, software
10
//        distributed under the License is distributed on an "AS IS" BASIS,
11
//        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//        See the License for the specific language governing permissions and
13
//        limitations under the License.
14
package store
15

16
import (
17
        "context"
18
        "strings"
19

20
        "github.com/mendersoftware/mender-server/pkg/identity"
21
)
22

23
// DbFromContext generates database name using tenant field from identity extracted
24
// from context and original database name
25
func DbFromContext(ctx context.Context, origDbName string) string {
6✔
26
        identity := identity.FromContext(ctx)
6✔
27
        tenant := ""
6✔
28
        if identity != nil {
11✔
29
                tenant = identity.Tenant
5✔
30
        }
5✔
31

32
        return DbNameForTenant(tenant, origDbName)
6✔
33
}
34

35
type TenantDbMatchFunc func(name string) bool
36

37
// IsTenantDb returns a function of `TenantDbMatchFunc` that can be used for
38
// checking if database has a tenant DB name format
39
func IsTenantDb(baseDb string) TenantDbMatchFunc {
4✔
40
        prefix := baseDb + "-"
4✔
41
        return func(name string) bool {
8✔
42
                return strings.HasPrefix(name, prefix)
4✔
43
        }
4✔
44
}
45

46
// TenantFromDbName attempts to extract tenant ID from provided tenant DB name.
47
// Returns extracted tenant ID or an empty string.
48
func TenantFromDbName(dbName string, baseDb string) string {
5✔
49
        noBase := strings.TrimPrefix(dbName, baseDb+"-")
5✔
50
        if noBase == dbName {
10✔
51
                return ""
5✔
52
        }
5✔
53
        return noBase
×
54
}
55

56
// DbNameForTenant composes tenant's db name.
57
func DbNameForTenant(tenantId string, baseDb string) string {
6✔
58
        if tenantId == "" {
12✔
59
                return baseDb
6✔
60
        }
6✔
61
        return baseDb + "-" + tenantId
4✔
62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc