-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2274 from particle-iot/ch71862/startup-minimum-ra…
…m-slo Develop PoC for device-os-test-runner tool to validate minimum RAM SLO is achieved
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "application.h" | ||
#include "test.h" | ||
|
||
test(slo_startup_stats) | ||
{ | ||
Particle.connect(); | ||
waitUntil(Particle.connected); | ||
uint32_t free_mem = System.freeMemory(); | ||
String stats = String::format("{\"free_mem\": %u }", free_mem); | ||
Particle.publish("startup_stats", stats); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
suite('Device startup service level objectives (SLOs)'); | ||
|
||
// intentionally omit `platform('...');` this test is relevant to ALL Particle platforms | ||
|
||
test('slo startup stats', async function () { | ||
const unparsedJson = await this.particle.receiveEvent('startup_stats'); | ||
const startupStats = JSON.parse(unparsedJson); | ||
|
||
/// | ||
// Assertions against the minimum RAM SLO | ||
/// | ||
const minimumRAMTargetDefault = 60000; | ||
const minimumRAMTargetForPhotonAndP1 = 45000; | ||
let target = minimumRAMTargetDefault; | ||
|
||
// make exceptions on target for photon/p1 | ||
const dut = this.particle.devices[0]; // see device-os-test-runner for documentation | ||
if (dut.platform.name == 'photon' || dut.platform.name == 'p1') { | ||
target = minimumRAMTargetForPhotonAndP1; | ||
} | ||
// show actuals first before assertions | ||
console.log(`actual_free_mem=${startupStats.free_mem} target_free_mem=${target} platform=${dut.platform.name}`); | ||
|
||
// make free ram assertion | ||
expect(startupStats.free_mem).to.be.at.least(target); | ||
}); |