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

mendersoftware / mender / 1583599051

11 Dec 2024 09:04AM UTC coverage: 76.259% (-0.2%) from 76.43%
1583599051

push

gitlab-ci

vpodzime
fix: Cancel the previous request before scheduling a new one in HTTP resumer

The `http::Client()` class is designed to always have only one
HTTP request in progress. Thus, before scheduling a new request
using the same `http::Client` instance, cancel the previous
request to make sure everything is properly reset for the new
one.

Ticket: MEN-7810
Changelog: Fix download resuming to reset the HTTP state and
avoid repeatedly hitting the same error in case of a bad state

Signed-off-by: Vratislav Podzimek <vratislav.podzimek@northern.tech>

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

55 existing lines in 11 files now uncovered.

7375 of 9671 relevant lines covered (76.26%)

11182.97 hits per line

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

72.73
/src/mender-update/cli/actions.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_ACTIONS_HPP
16
#define MENDER_UPDATE_ACTIONS_HPP
17

18
#include <common/error.hpp>
19
#include <common/expected.hpp>
20

21
#include <mender-update/context.hpp>
22

23
namespace mender {
24
namespace update {
25
namespace cli {
26

27
using namespace std;
28

29
namespace error = mender::common::error;
30
namespace expected = mender::common::expected;
31

32
namespace context = mender::update::context;
33

34
class Action {
60✔
35
public:
36
        virtual ~Action() {};
37

38
        virtual error::Error Execute(context::MenderContext &main_context) = 0;
39
};
40
using ActionPtr = shared_ptr<Action>;
41
using ExpectedActionPtr = expected::expected<ActionPtr, error::Error>;
42

43
class ShowArtifactAction : virtual public Action {
2✔
44
public:
45
        error::Error Execute(context::MenderContext &main_context) override;
46
};
47

48
class ShowProvidesAction : virtual public Action {
40✔
49
public:
50
        error::Error Execute(context::MenderContext &main_context) override;
51
};
52

53
class BaseInstallAction : virtual public Action {
54
public:
55
        void SetRebootExitCode(bool val) {
56
                reboot_exit_code_ = val;
73✔
57
        }
58

59
        void SetStopBefore(vector<string> val) {
60
                stop_before_ = std::move(val);
87✔
61
        }
62

63
protected:
64
        bool reboot_exit_code_ {false};
65
        vector<string> stop_before_;
66
};
67

68
class InstallAction : public BaseInstallAction {
69
public:
70
        InstallAction(const string &src) :
60✔
71
                src_ {src} {
120✔
72
        }
60✔
73

74
        error::Error Execute(context::MenderContext &main_context) override;
75

76
private:
77
        string src_;
78
};
79

80
class ResumeAction : public BaseInstallAction {
81
public:
82
        error::Error Execute(context::MenderContext &main_context) override;
83
};
84

85
class CommitAction : public BaseInstallAction {
86
public:
87
        error::Error Execute(context::MenderContext &main_context) override;
88
};
89

90
class RollbackAction : public BaseInstallAction {
91
public:
92
        error::Error Execute(context::MenderContext &main_context) override;
93
};
94

UNCOV
95
class DaemonAction : virtual public Action {
×
96
public:
97
        error::Error Execute(context::MenderContext &main_context) override;
98
};
99

UNCOV
100
class SendInventoryAction : virtual public Action {
×
101
public:
102
        error::Error Execute(context::MenderContext &main_context) override;
103
};
104

UNCOV
105
class CheckUpdateAction : virtual public Action {
×
106
public:
107
        error::Error Execute(context::MenderContext &main_context) override;
108
};
109

110
error::Error MaybeInstallBootstrapArtifact(context::MenderContext &main_context);
111

112
} // namespace cli
113
} // namespace update
114
} // namespace mender
115

116
#endif // MENDER_UPDATE_ACTIONS_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

© 2025 Coveralls, Inc