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

mendersoftware / mender-server / 1622978334

13 Jan 2025 03:51PM UTC coverage: 72.802% (-3.8%) from 76.608%
1622978334

Pull #300

gitlab-ci

alfrunes
fix: Deployment device count should not exceed max devices

Added a condition to skip deployments when the device count reaches max
devices.

Changelog: Title
Ticket: MEN-7847
Signed-off-by: Alf-Rune Siqveland <alf.rune@northern.tech>
Pull Request #300: fix: Deployment device count should not exceed max devices

4251 of 6164 branches covered (68.96%)

Branch coverage included in aggregate %.

0 of 18 new or added lines in 1 file covered. (0.0%)

2544 existing lines in 83 files now uncovered.

42741 of 58384 relevant lines covered (73.21%)

21.49 hits per line

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

92.31
/backend/services/deployments/model/status.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
        "encoding/json"
19

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

24
var (
25
        ErrBadStatus = errors.New("unknown status value")
26
)
27

28
type StatusReport struct {
29
        Status   DeviceDeploymentStatus `json:"status"`
30
        SubState string                 `json:"substate"`
31
}
32

33
func (s StatusReport) Validate() error {
1✔
34
        return validation.ValidateStruct(&s,
1✔
35
                validation.Field(&s.SubState, lengthIn0To200),
1✔
36
                validation.Field(&s.Status, validation.In(
1✔
37
                        DeviceDeploymentStatusDownloading,
1✔
38
                        DeviceDeploymentStatusInstalling,
1✔
39
                        DeviceDeploymentStatusRebooting,
1✔
40
                        DeviceDeploymentStatusSuccess,
1✔
41
                        DeviceDeploymentStatusFailure,
1✔
42
                        DeviceDeploymentStatusAlreadyInst,
1✔
43
                        DeviceDeploymentStatusPauseBeforeInstall,
1✔
44
                        DeviceDeploymentStatusPauseBeforeCommit,
1✔
45
                        DeviceDeploymentStatusPauseBeforeReboot,
1✔
46
                )),
1✔
47
        )
1✔
48
}
1✔
49

50
func (s *StatusReport) UnmarshalJSON(raw []byte) error {
1✔
51
        type statusReport StatusReport
1✔
52
        err := json.Unmarshal(raw, (*statusReport)(s))
1✔
53
        if err != nil {
1✔
UNCOV
54
                return err
×
UNCOV
55
        }
×
56

57
        if err := s.Validate(); err != nil {
2✔
58
                return err
1✔
59
        }
1✔
60

61
        return nil
1✔
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