-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control plane testing overhaul #7
Conversation
…ess always worked
operator/control-plane/src/market.rs
Outdated
&test::get_gb_rates(), | ||
&Vec::from([ | ||
allowed_regions: vec!["ap-south-1".to_owned()], | ||
address_whitelist: vec![ | ||
"0x0000000000000000000000000f5f91ba30a00bd43bd19466f020b3e5fc7a49ec".to_string(), |
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.
we can parameterize this address during test setup. And provide the same to test::getLogs(). It was't clear what value should this address match to, since getLogs uses some default address.
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.
get_log is actually quite messy, it uses the hardcoded address for everything from emitting contract to sender to depositors, should probably rework that
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.
done
operator/control-plane/src/market.rs
Outdated
let log = test::get_log(Action::Open, | ||
Bytes::from(("{\"region\":\"ap-south-1\",\"url\":\"https://example.com/enclave.eif\",\"instance\":\"c6a.xlarge\",\"memory\":4096,\"vcpu\":2}".to_string(),31000000000000u64,31000u64,market::now_timestamp().as_secs()).abi_encode_sequence()), | ||
Bytes::from(("{\"region\":\"ap-south-1\",\"url\":\"https://example.com/enclave.eif\",\"instance\":\"c6a.xlarge\",\"memory\":4096,\"vcpu\":2}".to_string(),31000000000000u64,31000u64,0).abi_encode_sequence()), | ||
B256::ZERO); | ||
let address_whitelist = vec![ | ||
"0x0000000000000000000000000f5f91ba30a00bd43bd19466f020b3e5fc7a49ec".to_string(), |
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 also address can be parameterized.
operator/control-plane/src/market.rs
Outdated
let job_logs: Vec<(u64, Log)> = vec![ | ||
(0, Action::Open, ("{\"region\":\"ap-south-1\",\"url\":\"https://example.com/enclave.eif\",\"instance\":\"c6a.xlarge\",\"memory\":4096,\"vcpu\":2}".to_string(),31000000000000u64,31000u64,market::now_timestamp().as_secs()).abi_encode_sequence()), | ||
let logs = vec![ | ||
(0, Action::Open, ("{\"region\":\"ap-south-1\",\"url\":\"https://example.com/enclave.eif\",\"instance\":\"c6a.xlarge\",\"memory\":4096,\"vcpu\":2}".to_string(),31000000000000u64,31000u64,0).abi_encode_sequence()), | ||
// instance type has also been updated in the metadata. should fail this job. |
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.
remove this comment, there is not change in instance type. Also, in this test, instance should be running instead of failing since there isn't any update, please check.
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.
comment is wrong, removed. Behaviour is correct though, matches the code which exits if there is no change. Good q as to whether that is desirable, but out of scope for this PR IMO.
LGTM |
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.
LGTM
Complete overhaul of control plane testing infrastructure with the goal of
Summary of changes:
SystemContext
to wrap the start time global so tests have separate instances and run without interfering with each otherUpdateEnclaveImageOutcome
to trackupdate_enclave_image
calls explicitlyTests themselves and coverage can be improved as well but that's for another day.