Repository navigation
Conversation
8423944 to
5536c47
Compare
5536c47 to
3b44bfe
Compare
3b44bfe to
2c4de8d
Compare
2c4de8d to
229632d
Compare
1f746b3 to
50086c5
Compare
50086c5 to
f78d872
Compare
f78d872 to
173188f
Compare
173188f to
8aeacce
Compare
8aeacce to
8174468
Compare
8174468 to
ee20f3d
Compare
ee20f3d to
f963834
Compare
f963834 to
5a95063
Compare
5a95063 to
c10c35a
Compare
c10c35a to
e04d4bd
Compare
| path.write_text(json.dumps(payload)) | ||
|
|
||
|
|
||
| class FakeBackend: |
There was a problem hiding this comment.
IMO the FakeBackend should be added with the relevant Rust code.
| self.default_vm = DEFAULT_VM | ||
| self.add_vm(DEFAULT_VM) | ||
|
|
||
| def add_vm(self, vm_id, **fields): |
There was a problem hiding this comment.
Can you document functions?
| @@ -0,0 +1,180 @@ | |||
| # SPDX-License-Identifier: BSD-3-Clause | |||
There was a problem hiding this comment.
IMO the tests should come in a separate commit.
|
|
||
|
|
||
| def test_actuation_enforces_vcpu_cap(controller, fake_backend, run_threshold, fast_threshold): | ||
| """A managed VM's pool stays within its vCPU count.""" |
There was a problem hiding this comment.
I generally prefer documenting a test more explicitly, e.g. "Test that foo does such and such.", no strong feeling though.
|
|
||
|
|
||
| @pytest.fixture | ||
| def run_threshold(controller): |
There was a problem hiding this comment.
Shouldn't this be called run_controller?
| CONTROLLER_INTERFACE = "com.nutanix.io_thread_controller1" | ||
| POLL_S = 0.2 | ||
|
|
||
|
|
There was a problem hiding this comment.
Can you document what non-trivial functions do?
| self.add_vm(DEFAULT_VM) | ||
|
|
||
| def add_vm(self, vm_id, **fields): | ||
| defaults = { |
There was a problem hiding this comment.
Can we use a class instead and abstract the way it's written to disk so that it's more maintanable.
| path.write_text(json.dumps(payload)) | ||
|
|
||
|
|
||
| class FakeBackend: |
There was a problem hiding this comment.
I have a vague feeling that we might be able to use Python's mock for this, need to think about it.
| ) | ||
|
|
||
|
|
||
| class DBusServer: |
There was a problem hiding this comment.
Can you document a bit what's this about?
| self._proc.wait(timeout=5) | ||
|
|
||
|
|
||
| class MockProc: |
|
|
||
|
|
||
| class Controller: | ||
| """Starts ``io-thread-controller`` against the fake backend.""" |
There was a problem hiding this comment.
Is that the real controller it starts?
e04d4bd to
3c8cc6e
Compare
AI-Generated: Most of it Signed-off-by: Leonardo Forchini <leonardo.forchini@nutanix.com>
3c8cc6e to
6d16886
Compare
Add component tests which ensure the controller enforces configured
limits such as vCPU cap and thread bounds. Also include the fixtures
necessary for these tests.
Signed-off-by: Leonardo Forchini leonardo.forchini@nutanix.com
Stack created with GitHub Stacks CLI • Give Feedback 💬