• 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

61.54
/backend/services/deviceconfig/model/device.go
1
// Copyright 2021 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 model
16

17
import (
18
        "time"
19

20
        validation "github.com/go-ozzo/ozzo-validation/v4"
21
        "github.com/google/uuid"
22
        "github.com/pkg/errors"
23
)
24

25
type Device struct {
26
        // ID is the device id assigned by deviceauth
27
        ID string `bson:"_id" json:"id"`
28

29
        // ConfiguredAttributes are the configured attributes for the device.
30
        ConfiguredAttributes Attributes `bson:"configured,omitempty" json:"configured"`
31
        // ReportedAttributes are the configuration reported by the device.
32
        ReportedAttributes Attributes `bson:"reported,omitempty" json:"reported"`
33
        // DeploymentID is the ID of the latest configuration deployment
34
        DeploymentID *uuid.UUID `bson:"deployment_id,omitempty" json:"deployment_id,omitempty"`
35

36
        // UpdatedTS holds the timestamp for when the desired state changed,
37
        // including when the object was created.
38
        UpdatedTS *time.Time `bson:"updated_ts" json:"updated_ts"`
39
        // ReportTS holds the timestamp when the device last reported its' state.
40
        ReportTS *time.Time `bson:"reported_ts,omitempty" json:"reported_ts,omitempty"`
41
}
42

43
func (dev Device) Validate() error {
1✔
44
        err := validation.ValidateStruct(&dev,
1✔
45
                validation.Field(&dev.ID, validation.Required),
1✔
46
                validation.Field(&dev.ConfiguredAttributes),
1✔
47
                validation.Field(&dev.ReportedAttributes),
1✔
48
        )
1✔
49
        return errors.Wrap(err, "invalid device object")
1✔
50
}
1✔
51

52
type NewDevice struct {
53
        ID string `json:"device_id"`
54
}
55

UNCOV
56
func (dev NewDevice) Validate() error {
×
UNCOV
57
        return validation.ValidateStruct(&dev,
×
UNCOV
58
                validation.Field(&dev.ID, validation.Required),
×
UNCOV
59
        )
×
UNCOV
60
}
×
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