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

mendersoftware / mender-server / 1495380963

14 Oct 2024 03:35PM UTC coverage: 70.373% (-2.5%) from 72.904%
1495380963

Pull #101

gitlab-ci

mineralsfree
feat: tenant list added

Ticket: MEN-7568
Changelog: None

Signed-off-by: Mikita Pilinka <mikita.pilinka@northern.tech>
Pull Request #101: feat: tenant list added

4406 of 6391 branches covered (68.94%)

Branch coverage included in aggregate %.

88 of 183 new or added lines in 10 files covered. (48.09%)

2623 existing lines in 65 files now uncovered.

36673 of 51982 relevant lines covered (70.55%)

31.07 hits per line

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

85.0
/backend/services/iot-manager/store/mongo/migration_1_1_1.go
1
// Copyright 2024 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

15
package mongo
16

17
import (
18
        "context"
19

20
        "go.mongodb.org/mongo-driver/bson"
21
        "go.mongodb.org/mongo-driver/mongo"
22
        mopts "go.mongodb.org/mongo-driver/mongo/options"
23

24
        "github.com/mendersoftware/mender-server/pkg/mongo/migrate"
25
)
26

27
const (
28
        IndexNameTTL = `log_TTL`
29
)
30

31
type migration_1_1_1 struct {
32
        client *mongo.Client
33
        db     string
34
}
35

36
// Up creates indexes for fetching event documents
37
func (m *migration_1_1_1) Up(from migrate.Version) error {
1✔
38
        ctx := context.Background()
1✔
39
        eventModel := mongo.IndexModel{
1✔
40
                Keys: bson.D{
1✔
41
                        {Key: KeyEventExpireTs, Value: 1},
1✔
42
                },
1✔
43
                Options: mopts.Index().
1✔
44
                        SetName(IndexNameTTL).
1✔
45
                        SetExpireAfterSeconds(0),
1✔
46
        }
1✔
47
        _, err := m.client.
1✔
48
                Database(m.db).
1✔
49
                Collection(CollNameLog).
1✔
50
                Indexes().
1✔
51
                CreateOne(ctx, eventModel)
1✔
52
        return err
1✔
53
}
1✔
54

UNCOV
55
func (m *migration_1_1_1) Version() migrate.Version {
×
UNCOV
56
        return migrate.MakeVersion(1, 1, 1)
×
UNCOV
57
}
×
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