-
Notifications
You must be signed in to change notification settings - Fork 61
Feat/ota 2282/more failure simulation #1145
Conversation
This pull request introduces 2 alerts when merging ad132cc into 935e0ce - view on LGTM.com new alerts:
Comment posted by LGTM.com |
ad132cc
to
8ef5496
Compare
Codecov Report
@@ Coverage Diff @@
## master #1145 +/- ##
==========================================
+ Coverage 77.74% 77.83% +0.09%
==========================================
Files 167 167
Lines 9947 9994 +47
==========================================
+ Hits 7733 7779 +46
- Misses 2214 2215 +1
Continue to review full report at Codecov.
|
abcfec6
to
989118c
Compare
989118c
to
fb7ba7e
Compare
Ok I've cleaned a bit the CMake invocations for running Last things on my list:
But the bulk of the work is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far!
for (auto it = serials.cbegin() + 1; it != serials.cend(); it++) { | ||
auto statement = db.prepareStatement<int64_t, std::string, std::string>( | ||
"INSERT INTO ecu_serials(id,serial,hardware_id) VALUES (?,?,?);", it - serials.cbegin(), it->first.ToString(), | ||
it->second.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the ID is just purely for sequencing, and we just trust that what we receive from the server is the order we should maintain? Not a bad idea to finally make it explicit instead of assuming primary is always first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the id is for sequencing.
I don't believe the order comes from the server, but the local config:
storage_->storeEcuSerials(ecu_serials); |
Hope I haven't overlooked anything but the intent is that any two devices with the same configuration (i.e: with same sets of ecu, deducted from configuration files named the same) would have their ecus in the same order, so that we can safely match them with the same device error code if several ecus fail.
e.g: ecu1:fail1|ecu2:fail2
and never ecu2:fail2|ecu1:fail1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bad idea to finally make it explicit instead of assuming primary is always first.
The api still expects a list of serials that start with the primary.
|
||
Aktualizr aktualizr(conf, storage, http); | ||
|
||
// TODO: was stolen from other test, refactor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh-oh, a TODO!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, refactored a bit
tests/fiuinfo_test.cc
Outdated
TEST(Fiuinfo, PassInfoWithCtrl) { | ||
EXPECT_EQ(fiu_fail("failctrl"), 0); | ||
Utils::shell(fiu_script + " ctrl -c 'enable name=failctrl,failinfo=test_ctrl' " + std::to_string(getpid()), nullptr); | ||
EXPECT_NE(fiu_fail("failctrl"), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I think checking that we can unset the failure and recover is worthwhile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be covered now.
fb7ba7e
to
a51704b
Compare
Pushed minor changes in the fault injection part, as it was needlessly depending on having |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking even better!
tests/fiuinfo_test.cc
Outdated
|
||
TEST(Fiuinfo, PassInfoWithRun) { | ||
EXPECT_TRUE(fiu_fail("fail")); | ||
EXPECT_EQ(fault_injection_last_info(), "test"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does "test" come from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here:
aktualizr/tests/CMakeLists.txt
Line 77 in a51704b
add_aktualizr_test(NAME fiuinfo SOURCES fiuinfo_test.cc NO_VALGRIND LAUNCH_CMD ${PROJECT_SOURCE_DIR}/scripts/fiu run -c "enable name=fail,failinfo=test" -- ARGS ${PROJECT_SOURCE_DIR}/scripts/fiu) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It could perhaps be a more greppable string, but not a big deal at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, changed it to something more unique
The new constraints are: primary first and `loadEcuSerials` returns the same order as given in the `storeEcuSerials` vector parameter. Signed-off-by: Laurent Bonnans <[email protected]>
Signed-off-by: Laurent Bonnans <[email protected]>
Put the string result inside quotes, so that it can contain `:`. Useful when the device code reflects the ECUs Signed-off-by: Laurent Bonnans <[email protected]>
+ some refactor Signed-off-by: Laurent Bonnans <[email protected]>
libfiu only supports sending long unsigned, so work around it by storing strings in a binary file Signed-off-by: Laurent Bonnans <[email protected]>
Path is passed through FIU_INFO_FILE, id has the 31th bit set to 1 Signed-off-by: Laurent Bonnans <[email protected]>
a51704b
to
8f9ac73
Compare
Proxy script for fiu-run and fiu-ctrl (`fiu run`, `fiu ctrl`). Syntax is the same, except that it can send strings through `failinfo=`, via an intermediary file. The file is temporary when passed through fiu-run, otherwise it's named after the targets' pid. Signed-off-by: Laurent Bonnans <[email protected]>
And not description, like before Signed-off-by: Laurent Bonnans <[email protected]>
Signed-off-by: Laurent Bonnans <[email protected]>
Signed-off-by: Laurent Bonnans <[email protected]>
8f9ac73
to
cccfa33
Compare
Based on #1144.
In a nutshell:
ecu_type:error
in case of errorWill add a test for the changes in
SotaUptaneClient::computeDeviceInstallationResult
when ready