blob: afea475b4bdaa2a2783d9cb398e218851ee059bf [file] [log] [blame]
Patrick Venture16ab2a12019-05-31 08:52:51 -07001/* The goal of these tests is to verify the behavior of all blob commands given
2 * the current state is updateStarted. This state is achieved as an exit from
3 * updatePending.
4 */
5#include "firmware_handler.hpp"
6#include "firmware_unittest.hpp"
7#include "status.hpp"
8#include "util.hpp"
9
10#include <cstdint>
11#include <string>
12#include <vector>
13
14#include <gtest/gtest.h>
15
16namespace ipmi_flash
17{
18namespace
19{
20
21using ::testing::Return;
22
23/*
24 * There are the following calls (parameters may vary):
25 * canHandleBlob(blob)
26 * getBlobIds
27 * deleteBlob(blob)
28 * stat(blob)
29 * stat(session)
30 * open(blob)
31 * close(session)
32 * writemeta(session)
33 * write(session)
34 * read(session)
35 * commit(session)
36 */
37
38class FirmwareHandlerUpdateStartedTest : public IpmiOnlyFirmwareStaticTest
39{
40};
41
Patrick Venturef515b9c2019-05-31 10:38:16 -070042/*
43 * open(blob)
44 */
45TEST_F(FirmwareHandlerUpdateStartedTest, AttemptToOpenFilesReturnsFailure)
46{
47 /* In state updateStarted a file is open, which means no others can be. */
48 getToUpdateStarted();
49
50 auto blobsToOpen = handler->getBlobIds();
51 for (const auto& blob : blobsToOpen)
52 {
53 EXPECT_FALSE(handler->open(session + 1, flags, blob));
54 }
55}
56
Patrick Venture16ab2a12019-05-31 08:52:51 -070057/* canHandleBlob(blob)
58 * getBlobIds
59 */
60
61/*
62 * TODO: deleteBlob(blob)
63 */
64
65/*
66 * stat(blob)
67 */
68
69/*
70 * stat(session)
71 */
Patrick Venture16ab2a12019-05-31 08:52:51 -070072
73/*
74 * close(session)
75 */
76
77/*
78 * writemeta(session)
79 */
80
81/*
82 * write(session)
83 */
84
85/*
86 * read(session)
87 */
88
89/*
90 * commit(session)
91 */
92
93} // namespace
94} // namespace ipmi_flash