Skip to content

Commit 0355050

Browse files
committed
test: Add API hinting endpoints
Adding new resources to the http api to enable testing of the hinting functionality. Signed-off-by: Jack Thomson <jackabt@amazon.com>
1 parent 4dfbe30 commit 0355050

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/firecracker/src/api_server/parsed_request.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ pub mod tests {
328328
use micro_http::HttpConnection;
329329
use vmm::builder::StartMicrovmError;
330330
use vmm::cpu_config::templates::test_utils::build_test_template;
331+
use vmm::devices::virtio::balloon::device::HintingStatus;
331332
use vmm::resources::VmmConfig;
332333
use vmm::rpc_interface::VmmActionError;
333334
use vmm::vmm_config::balloon::{BalloonDeviceConfig, BalloonStats};
@@ -605,6 +606,9 @@ pub mod tests {
605606
swap_out: Some(1),
606607
..Default::default()
607608
}));
609+
verify_ok_response_with(VmmData::HintingStatus(HintingStatus {
610+
..Default::default()
611+
}));
608612
verify_ok_response_with(VmmData::Empty);
609613
verify_ok_response_with(VmmData::FullVmConfig(VmmConfig::default()));
610614
verify_ok_response_with(VmmData::MachineConfiguration(MachineConfig::default()));

src/firecracker/src/api_server/request/balloon.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ mod tests {
115115
parse_get_balloon(["statistics"].into_iter()).unwrap();
116116

117117
parse_get_balloon(["hinting", "status"].into_iter()).unwrap();
118+
parse_get_balloon(["hinting", "unrelated"].into_iter()).unwrap_err();
118119
parse_get_balloon(["hinting"].into_iter()).unwrap_err();
119120
}
120121

src/vmm/src/rpc_interface.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,11 @@ mod tests {
11751175
check_unsupported(preboot_request(VmmAction::UpdateBalloon(
11761176
BalloonUpdateConfig { amount_mib: 0 },
11771177
)));
1178+
check_unsupported(preboot_request(VmmAction::StartFreePageHinting(
1179+
Default::default(),
1180+
)));
1181+
check_unsupported(preboot_request(VmmAction::GetFreePageHintingStatus));
1182+
check_unsupported(preboot_request(VmmAction::StopFreePageHinting));
11781183
check_unsupported(preboot_request(VmmAction::UpdateBalloonStatistics(
11791184
BalloonUpdateStatsConfig {
11801185
stats_polling_interval_s: 0,

tests/framework/http_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ def __init__(self, api_usocket_full_name, *, on_error=None):
127127
self.mmds_config = Resource(self, "/mmds/config")
128128
self.balloon = Resource(self, "/balloon")
129129
self.balloon_stats = Resource(self, "/balloon/statistics")
130+
self.balloon_hinting_start = Resource(self, "/balloon/hinting/start")
131+
self.balloon_hinting_status = Resource(self, "/balloon/hinting/status")
132+
self.balloon_hinting_stop = Resource(self, "/balloon/hinting/stop")
130133
self.vsock = Resource(self, "/vsock")
131134
self.snapshot_create = Resource(self, "/snapshot/create")
132135
self.snapshot_load = Resource(self, "/snapshot/load")

0 commit comments

Comments
 (0)