示例#1
0
 def destroy_app(self, server: Device) -> None:
     try:
         server.connect()
         server.execute("cd oct")
         server.execute("docker-compose down")
         assert is_deploy_app(server, Status.OFF.value)
         server.execute("cd ~")
         server.execute("rm -rf oct")
     except (ConnectTimeout, ReadTimeout):
         self.failed()
     finally:
         server.disconnect()
示例#2
0
 def deploy_app(self, device: Device) -> None:
     try:
         device.connect()
         device.execute("mkdir oct")
         copy_file_to_server(device)
         device.execute("cd oct")
         device.execute(
             f"APP_HOST={device.connections.main.ip} docker-compose up -d")
         assert is_deploy_app(device, Status.ON.value)
     except ConnectTimeout:
         self.failed()
     finally:
         device.disconnect()
示例#3
0
def is_deploy_app(device: Device, is_run: int) -> bool:
    non_empty_lines_counter = 0
    for iterator in device.execute("docker-compose ps -q"):
        if iterator == "\n":
            non_empty_lines_counter += 1
    return non_empty_lines_counter == is_run