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

mendersoftware / mender / 968408678

pending completion
968408678

push

gitlab-ci

oleorhagen
feat(artifact/scripts): Add support for executing state scripts

Ticket: MEN-6636
Changelog: None

Signed-off-by: Ole Petter <ole.orhagen@northern.tech>

126 of 126 new or added lines in 4 files covered. (100.0%)

5405 of 6857 relevant lines covered (78.82%)

195.75 hits per line

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

28.57
/artifact/v3/scripts/error.cpp
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

15
#include <artifact/v3/scripts/error.hpp>
16

17
#include <cassert>
18

19
#include <string>
20

21
namespace mender {
22
namespace artifact {
23
namespace scripts {
24
namespace executor {
25
namespace error {
26

27
using namespace std;
28

29
namespace merror = mender::common::error;
30

31
const ErrorCategoryClass ErrorCategory;
32

33
const char *ErrorCategoryClass::name() const noexcept {
×
34
        return "ArtifactScriptExecutorCategory";
×
35
}
36

37
string ErrorCategoryClass::message(int code) const {
1✔
38
        switch (code) {
1✔
39
        case NoError:
×
40
                return "Success";
×
41
        case VersionFileError:
×
42
                return "Version file error";
×
43
        case VersionFileWrongVersionError:
×
44
                return "Version file version error";
×
45
        case SetupError:
×
46
                return "Setup error";
×
47
        case CollectionError:
×
48
                return "Failed to collect the scripts";
×
49
        case NonZeroExitStatusError:
1✔
50
                return "NonZero exit code error";
1✔
51
        case RetryExitCodeError:
×
52
                return "Retry exit code error";
×
53
        }
54
        assert(false);
×
55
        return "Unknown";
56
}
57

58
merror::Error MakeError(Code code, const string &msg) {
7✔
59
        return merror::Error(error_condition(code, ErrorCategory), msg);
14✔
60
}
61

62
} // namespace error
63
} // namespace executor
64
} // namespace scripts
65
} // namespace artifact
66
} // namespace mender
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