Skip to content

Commit 8848ce7

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 ecb0150 commit 8848ce7

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
@@ -341,6 +341,7 @@ pub mod tests {
341341
use micro_http::HttpConnection;
342342
use vmm::builder::StartMicrovmError;
343343
use vmm::cpu_config::templates::test_utils::build_test_template;
344+
use vmm::devices::virtio::balloon::device::HintingStatus;
344345
use vmm::resources::VmmConfig;
345346
use vmm::rpc_interface::VmmActionError;
346347
use vmm::vmm_config::balloon::{BalloonDeviceConfig, BalloonStats};
@@ -621,6 +622,9 @@ pub mod tests {
621622
swap_out: Some(1),
622623
..Default::default()
623624
}));
625+
verify_ok_response_with(VmmData::HintingStatus(HintingStatus {
626+
..Default::default()
627+
}));
624628
verify_ok_response_with(VmmData::Empty);
625629
verify_ok_response_with(VmmData::FullVmConfig(VmmConfig::default()));
626630
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
@@ -1219,6 +1219,11 @@ mod tests {
12191219
check_unsupported(preboot_request(VmmAction::UpdateBalloon(
12201220
BalloonUpdateConfig { amount_mib: 0 },
12211221
)));
1222+
check_unsupported(preboot_request(VmmAction::StartFreePageHinting(
1223+
Default::default(),
1224+
)));
1225+
check_unsupported(preboot_request(VmmAction::GetFreePageHintingStatus));
1226+
check_unsupported(preboot_request(VmmAction::StopFreePageHinting));
12221227
check_unsupported(preboot_request(VmmAction::UpdateBalloonStatistics(
12231228
BalloonUpdateStatsConfig {
12241229
stats_polling_interval_s: 0,

tests/framework/http_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ def __init__(self, api_usocket_full_name, *, validate=True, on_error=None):
173173
self.mmds_config = Resource(self, "/mmds/config")
174174
self.balloon = Resource(self, "/balloon")
175175
self.balloon_stats = Resource(self, "/balloon/statistics")
176+
self.balloon_hinting_start = Resource(self, "/balloon/hinting/start")
177+
self.balloon_hinting_status = Resource(self, "/balloon/hinting/status")
178+
self.balloon_hinting_stop = Resource(self, "/balloon/hinting/stop")
176179
self.vsock = Resource(self, "/vsock")
177180
self.snapshot_create = Resource(self, "/snapshot/create")
178181
self.snapshot_load = Resource(self, "/snapshot/load")

0 commit comments

Comments
 (0)