Hello,
I'm creating a program that lets me run unit tests on a Python application. The principle is that each test must be independent of the other. That's why I do a rollback of the vm at the desired moment at the end of each test. To rollback the vm, I use the Proxmox api and in particular the following command: api.nodes(name_of_node).qemu(id_of_the_vm).snapshot(name_of_the_snapshot).rollback().post().
Here's my problem:
At the start of each test, I create a test set-up to ensure that my test is applied in a particular context. So I can use libraries like Paramiko to instantiate an ssh connection and perform commands.
At the start of some tests, I notice that they fail because 'connection.timeout' or something like that. I've checked that my ssh connection function is good. I use it in other projects. I suppose it's because the rollback hasn't had time to take place that it's blocking the process. So I use time.sleep(x) everywhere to wait for the rollback to finish, but sometimes it doesn't work, and at the very least it slows down the program enormously for nothing.
Knowing that the vm is in 'running' status at rollback, it's not possible to play on this criteria. I don't know how to check that my vm's rollback is complete.
Thanks for your feedback
I'm creating a program that lets me run unit tests on a Python application. The principle is that each test must be independent of the other. That's why I do a rollback of the vm at the desired moment at the end of each test. To rollback the vm, I use the Proxmox api and in particular the following command: api.nodes(name_of_node).qemu(id_of_the_vm).snapshot(name_of_the_snapshot).rollback().post().
Here's my problem:
At the start of each test, I create a test set-up to ensure that my test is applied in a particular context. So I can use libraries like Paramiko to instantiate an ssh connection and perform commands.
At the start of some tests, I notice that they fail because 'connection.timeout' or something like that. I've checked that my ssh connection function is good. I use it in other projects. I suppose it's because the rollback hasn't had time to take place that it's blocking the process. So I use time.sleep(x) everywhere to wait for the rollback to finish, but sometimes it doesn't work, and at the very least it slows down the program enormously for nothing.
Knowing that the vm is in 'running' status at rollback, it's not possible to play on this criteria. I don't know how to check that my vm's rollback is complete.
Thanks for your feedback