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

mendersoftware / mender / 2281564137

23 Jan 2026 10:59AM UTC coverage: 81.48% (+1.7%) from 79.764%
2281564137

push

gitlab-ci

michalkopczan
fix: Schedule next deployment poll if current one failed early causing no handler to be called

Ticket: MEN-9144
Changelog: Fix a hang when polling for deployment failed early causing no handler of API response
to be called. Added handler call for this case, causing the deployment polling
to continue.

Signed-off-by: Michal Kopczan <michal.kopczan@northern.tech>

1 of 1 new or added line in 1 file covered. (100.0%)

327 existing lines in 44 files now uncovered.

8839 of 10848 relevant lines covered (81.48%)

20226.53 hits per line

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

25.0
/src/mender-update/inventory.hpp
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
#ifndef MENDER_UPDATE_INVENTORY_HPP
16
#define MENDER_UPDATE_INVENTORY_HPP
17

18
#include <string>
19

20
#include <api/client.hpp>
21
#include <common/error.hpp>
22
#include <common/events.hpp>
23
#include <common/expected.hpp>
24
#include <common/http.hpp>
25
#include <common/json.hpp>
26
#include <common/optional.hpp>
27

28
namespace mender {
29
namespace update {
30
namespace inventory {
31

32
using namespace std;
33

34
namespace api = mender::api;
35
namespace error = mender::common::error;
36
namespace events = mender::common::events;
37
namespace expected = mender::common::expected;
38
namespace json = mender::common::json;
39

40
enum InventoryErrorCode {
41
        NoError = 0,
42
        BadResponseError,
43
};
44
class InventoryErrorCategoryClass : public std::error_category {
45
public:
46
        const char *name() const noexcept override;
47
        string message(int code) const override;
48
};
49
extern const InventoryErrorCategoryClass InventoryErrorCategory;
50

51
error::Error MakeError(InventoryErrorCode code, const string &msg);
52

53
using APIResponse = error::Error;
54
using APIResponseHandler = function<void(APIResponse)>;
55

56
error::Error PushInventoryData(
57
        const string &inventory_generators_dir,
58
        events::EventLoop &loop,
59
        api::Client &client,
60
        size_t &last_data_hash,
61
        APIResponseHandler api_handler);
62

63
class InventoryAPI {
1✔
64
public:
65
        virtual ~InventoryAPI() {
66
        }
67

68
        virtual error::Error PushData(
69
                const string &inventory_generators_dir,
70
                events::EventLoop &loop,
71
                api::Client &client,
72
                APIResponseHandler api_handler) = 0;
73

74
        virtual void ClearDataCache() = 0;
75

76
        bool has_submitted_inventory {false};
77
};
78

79
class InventoryClient : public InventoryAPI {
96✔
80
public:
UNCOV
81
        error::Error PushData(
×
82
                const string &inventory_generators_dir,
83
                events::EventLoop &loop,
84
                api::Client &client,
85
                APIResponseHandler api_handler) override {
UNCOV
86
                return PushInventoryData(
×
UNCOV
87
                        inventory_generators_dir, loop, client, last_data_hash_, api_handler);
×
88
        };
89

UNCOV
90
        void ClearDataCache() override {
×
UNCOV
91
                last_data_hash_ = 0;
×
UNCOV
92
        }
×
93

94
private:
95
        size_t last_data_hash_ {0};
96
};
97

98
} // namespace inventory
99
} // namespace update
100
} // namespace mender
101

102
#endif // MENDER_UPDATE_INVENTORY_HPP
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

© 2026 Coveralls, Inc