forked from scylladb/scylla-cluster-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy_remote.py
97 lines (73 loc) · 2.38 KB
/
dummy_remote.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright (c) 2020 ScyllaDB
# pylint: disable=too-few-public-methods
import os
import shutil
import logging
from sdcm.remote import LocalCmdRunner
from sdcm.cluster import BaseNode, BaseCluster, BaseScyllaCluster
class DummyOutput:
def __init__(self, stdout):
self.stdout = stdout
class DummyRemote:
@staticmethod
def run(*args, **kwargs):
logging.info(args, kwargs)
return DummyOutput(args[0])
@staticmethod
def is_up():
return True
@staticmethod
def receive_files(src, dst):
shutil.copy(src, dst)
return True
class LocalNode(BaseNode):
# pylint: disable=too-many-arguments
def __init__(self, name, parent_cluster, ssh_login_info=None, base_logdir=None, node_prefix=None, dc_idx=0):
super().__init__(name, parent_cluster)
self.remoter = LocalCmdRunner()
self.logdir = os.path.dirname(__file__)
@property
def ip_address(self):
return "127.0.0.1"
@property
def region(self):
return "eu-north-1"
def _refresh_instance_state(self):
return "127.0.0.1", "127.0.0.1"
def _get_ipv6_ip_address(self):
pass
def check_spot_termination(self):
pass
def restart(self):
pass
class LocalLoaderSetDummy(BaseCluster):
# pylint: disable=super-init-not-called,abstract-method
def __init__(self, nodes=None):
self.name = "LocalLoaderSetDummy"
self.params = {}
self.nodes = nodes if nodes is not None else [LocalNode("loader_node", parent_cluster=self)]
@staticmethod
def get_db_auth():
return None
@staticmethod
def is_kubernetes():
return False
class LocalScyllaClusterDummy(BaseScyllaCluster):
# pylint: disable=super-init-not-called
def __init__(self):
self.name = "LocalScyllaClusterDummy"
self.params = {}
@staticmethod
def get_db_auth():
return None