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

mendersoftware / mender / 1197434403

01 Mar 2024 04:23PM UTC coverage: 75.661% (-0.06%) from 75.716%
1197434403

push

gitlab-ci

vpodzime
chore: Use HeaderView::GetDepends() in ArtifactMatchesContext()

Simplifies the code a bit and tests for ArtifactMatchesContext()
test HeaderView::GetDepends().

Ticket: MEN-6960
Changelog: none
Signed-off-by: Vratislav Podzimek <vratislav.podzimek@northern.tech>

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

8 existing lines in 2 files now uncovered.

7038 of 9302 relevant lines covered (75.66%)

11715.48 hits per line

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

0.0
/src/artifact/artifact.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_ARTIFACT_HPP_
16
#define MENDER_ARTIFACT_HPP_
17

18
#include <string>
19

20
#include <common/json.hpp>
21
#include <common/io.hpp>
22

23
#include <artifact/parser.hpp>
24
#include <artifact/config.hpp>
25

26
namespace mender {
27
namespace artifact {
28

29
using namespace std;
30

31
namespace error = mender::common::error;
32
namespace expected = mender::common::expected;
33
namespace json = mender::common::json;
34
namespace io = mender::common::io;
35

36
using error::Error;
37

38
using artifact::parser::Artifact;
39

40
using ExpectedArtifact = expected::expected<Artifact, error::Error>;
41

42
ExpectedArtifact Parse(io::Reader &reader, config::ParserConfig conf = {});
43

44
using namespace mender::artifact::v3::payload;
45
using HeaderInfo = v3::header::Info;
46
using v3::header::TypeInfo;
47

48
struct HeaderView {
49
        string artifact_group;
50
        string artifact_name;
51
        string payload_type;
52
        HeaderInfo header_info;
53
        TypeInfo type_info;
54
        json::Json meta_data;
55

56
        unordered_map<string, string> GetProvides() const;
57
        unordered_map<string, vector<string>> GetDepends() const;
58
};
59

UNCOV
60
struct PayloadHeaderView {
×
61
        int version;
62
        HeaderView header;
63
};
64

65
using ExpectedPayloadHeaderView = expected::expected<PayloadHeaderView, error::Error>;
66

67
// View is giving the meta-data view of a given payload index.
68
//
69
// This means that a PayloadHeaderView is the union of the global header-info,
70
// and the type-info for the given payload. A view will never leak information
71
// which is dedicated to another payload (given by it's index).
72
ExpectedPayloadHeaderView View(Artifact &artifact, size_t index);
73

74
} // namespace artifact
75
} // namespace mender
76

77

78
#endif // MENDER_ARTIFACT_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