Skip to content

Commit

Permalink
remove parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Canux CHENG authored and Canux CHENG committed Nov 26, 2019
1 parent 7944b4e commit 3207726
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 29 deletions.
12 changes: 6 additions & 6 deletions tests/test_database_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
class DatabaseTestCase(unittest.TestCase):
def test_select_query(self):
with BaseDB(
host='10.103.239.70', username='sandbox',
password='P@ssword', database='sandbox', port=1433
host='127.0.0.1', username='username',
password='password', database='test', port=1433
) as db:
results, keys = db.select_query("select @@version")
self.assertIsInstance(results, list, msg='results failed')
Expand Down Expand Up @@ -45,10 +45,10 @@ def test_dml_query(self):
host='127.0.0.1', username='username',
password='password', database='test', port=1433
) as db:
result = db.dml_query("delete from jobs where sample_sha256 = "
"'4ed869e5c11e23218d808f91b341f4e5fc28f729c2477f71cee956cf50dd3b16'")
result1 = db.dml_query("update samples set status = 'bad' where "
"sha256 = '4ed869e5c11e23218d808f91b341f4e5fc28f729c2477f71cee956cf50dd3b16'")
result = db.dml_query("delete from table where key = "
"'value'")
result1 = db.dml_query("update table set key = 'value' where "
"key = 'value'")


if __name__ == '__main__':
Expand Down
26 changes: 13 additions & 13 deletions tests/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ def test_swarm_init(self):
node_id = None
with BaseSwarm() as swarm:
node_id = swarm.init(
advertise_addr="10.103.239.40", force_new_cluster=True
advertise_addr="127.0.0.1", force_new_cluster=True
)
print(node_id)
self.assertIsNotNone(node_id, "swarm init failed")

@unittest.skip("ignore")
def test_swarm_join(self):
with BaseParamiko(
hostname="10.103.239.40", username="canux",
password="S0nicwall"
hostname="127.0.0.1", username="usernme",
password="password"
) as ssh:
output, error, rc = ssh.exec_command(
"docker swarm join-token -q worker"
Expand All @@ -62,18 +62,18 @@ def test_swarm_join(self):
print(token)
with BaseSwarm() as swarm:
result = swarm.join(
remote_addrs=["10.103.239.40:2377"],
join_token=token, advertise_addr="10.103.239.40"
remote_addrs=["127.0.0.1:2377"],
join_token=token, advertise_addr="127.0.0.1"
)
self.assertTrue(result, "swarm join failed.")

@unittest.skip("ignore")
def test_overlay(self):
name = "ol0"
subnet = "172.12.0.0/16"
iprange = "172.12.0.0/24"
gateway = "172.12.0.1"
opt_name = "ol0"
name = "docker1"
subnet = "172.19.0.0/16"
iprange = "172.19.0.0/24"
gateway = "172.19.0.1"
opt_name = "docker1"
with BaseNetworks() as network:
result = network.create_overlay_network(
name=name, subnet=subnet, iprange=iprange, gateway=gateway,
Expand All @@ -84,9 +84,9 @@ def test_overlay(self):

@unittest.skip("ignore")
def test_get_captureatp_version(self):
registry = "harbor.domain.com:4433"
project = "captureatp"
name = "sandboxav"
registry = "harbor.domain.com:443"
project = "app"
name = "test"
repo = "{}/{}/{}".format(registry, project, name)
with BaseImages() as image:
images = image.list(repo, if_all=True)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_grafana_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
class GrafanaTestCase(unittest.TestCase):
@unittest.skip('ignore')
def test_check_datasource_exist(self):
grafana = BaseGrafana("http://10.103.64.207:3000", "sandbox",
grafana = BaseGrafana("http://127.0.0.1:3000", "admin",
"password")
result = grafana.check_data_source_exist_by_name("MAF")
result = grafana.check_data_source_exist_by_name("devops")
self.assertEqual(True, result, msg="check datasource exist failed.")

def test_check_datasource_exist(self):
grafana = BaseGrafana("http://10.103.64.207:3000",
grafana = BaseGrafana("http://127.0.0.1:3000",
'eyJrIjoiSU84dnphRGlOUTlaeGNCdTQ3clJlZjBxZG9IUFQ3cGoiLCJuIjoidGVzdCIsImlkIjoxfQ=='
)
result = grafana.check_data_source_exist_by_name("MAF")
result = grafana.check_data_source_exist_by_name("devops")
self.assertEqual(True, result, msg="check datasource exist failed.")


Expand Down
3 changes: 0 additions & 3 deletions tests/test_influxdb_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def test_query(self):
"""
result = BaseInfluxdb().query("devops", ifql)
self.assertIsNotNone(result, 'select failed.')
"""
{'results': [{'statement_id': 0, 'series': [{'name': 'cpu', 'tags': {'host': 'AT-MySQL'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 0.03125586093945287], ['2019-11-19T09:40:00Z', 0.03958997499701411], ['2019-11-19T09:41:00Z', 0.04375117218303615], ['2019-11-19T09:42:00Z', 0.04583723990482724], ['2019-11-19T09:43:00Z', 0.04167330867234398], ['2019-11-19T09:44:00Z', 0.04688125038921953]]}, {'name': 'cpu', 'tags': {'host': 'AT-Rabbitmq-Haproxy'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 0.2501250627643259], ['2019-11-19T09:40:00Z', 0.2669670173403347], ['2019-11-19T09:41:00Z', 0.35020860447122004], ['2019-11-19T09:42:00Z', 0.300250225104719], ['2019-11-19T09:43:00Z', 0.31704212966837986], ['2019-11-19T09:44:00Z', 0.37507522549957173]]}, {'name': 'cpu', 'tags': {'host': 'AT-Rabbitmq01'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 0.4509018040227346], ['2019-11-19T09:40:00Z', 0.48381715054661356], ['2019-11-19T09:41:00Z', 0.583450116553351], ['2019-11-19T09:42:00Z', 0.5669502336797478], ['2019-11-19T09:43:00Z', 0.5671756715035485], ['2019-11-19T09:44:00Z', 0.47571357079544896]]}, {'name': 'cpu', 'tags': {'host': 'AT-Rabbitmq02'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 0.15022533814712347], ['2019-11-19T09:40:00Z', 0.33358354216329644], ['2019-11-19T09:41:00Z', 0.38348345841518494], ['2019-11-19T09:42:00Z', 0.36691691687042294], ['2019-11-19T09:43:00Z', 0.4001001000847708], ['2019-11-19T09:44:00Z', 0.40028773124370787]]}, {'name': 'cpu', 'tags': {'host': 'AT-Redis'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 0.05003752819244767], ['2019-11-19T09:40:00Z', 0.141675032254156], ['2019-11-19T09:41:00Z', 0.11671252617077243], ['2019-11-19T09:42:00Z', 0.14165005411926757], ['2019-11-19T09:43:00Z', 0.10837710878057294], ['2019-11-19T09:44:00Z', 0.16255001763602195]]}, {'name': 'cpu', 'tags': {'host': 'backup-server'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 1.587996248276184], ['2019-11-19T09:40:00Z', 1.1777606965329852], ['2019-11-19T09:41:00Z', 1.2629336351638472], ['2019-11-19T09:42:00Z', 1.240201263942751], ['2019-11-19T09:43:00Z', 1.127428122710569], ['2019-11-19T09:44:00Z', 1.22249467921921]]}, {'name': 'cpu', 'tags': {'host': 'gitlab'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 3.8281103402784424], ['2019-11-19T09:40:00Z', 3.311290865158], ['2019-11-19T09:41:00Z', 3.5475162263316946], ['2019-11-19T09:42:00Z', 3.353584195154781], ['2019-11-19T09:43:00Z', 3.336089292237105], ['2019-11-19T09:44:00Z', 2.692893340444357]]}, {'name': 'cpu', 'tags': {'host': 'jenkins'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 0.1626524865668415], ['2019-11-19T09:40:00Z', 0.11885217371116141], ['2019-11-19T09:41:00Z', 0.1063542732930074], ['2019-11-19T09:42:00Z', 0.1125980023593911], ['2019-11-19T09:43:00Z', 0.10843003414701968], ['2019-11-19T09:44:00Z', 0.07194264214393797]]}, {'name': 'cpu', 'tags': {'host': 'repo-ubuntu16'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 16.326416465400754], ['2019-11-19T09:40:00Z', 16.987985865078528], ['2019-11-19T09:41:00Z', 16.027362414904218], ['2019-11-19T09:42:00Z', 15.930524600712772], ['2019-11-19T09:43:00Z', 16.177572516879493], ['2019-11-19T09:44:00Z', 18.010139417063854]]}, {'name': 'cpu', 'tags': {'host': 'research'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 30.47511595803742], ['2019-11-19T09:40:00Z', 36.42952133947917], ['2019-11-19T09:41:00Z', 24.29001018455432], ['2019-11-19T09:42:00Z', 3.689162605377419], ['2019-11-19T09:43:00Z', 9.95440521676737], ['2019-11-19T09:44:00Z', 12.720892342859742]]}, {'name': 'cpu', 'tags': {'host': 'samples'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 1.1638092845018377], ['2019-11-19T09:40:00Z', 1.5474272887059897], ['2019-11-19T09:41:00Z', 1.5473625546416798], ['2019-11-19T09:42:00Z', 1.3978749994601003], ['2019-11-19T09:43:00Z', 1.2135650349546694], ['2019-11-19T09:44:00Z', 1.4077570875834908]]}, {'name': 'cpu', 'tags': {'host': 'soniclinux-repo'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 0.5005004986481225], ['2019-11-19T09:40:00Z', 0.4839175766902031], ['2019-11-19T09:41:00Z', 0.8690839841601843], ['2019-11-19T09:42:00Z', 0.6685232929676204], ['2019-11-19T09:43:00Z', 1.0696469107433728], ['2019-11-19T09:44:00Z', 0.5005004986481225]]}, {'name': 'cpu', 'tags': {'host': 'workstation'}, 'columns': ['time', 'idle'], 'values': [['2019-11-19T09:39:00Z', 2.6376720900224626], ['2019-11-19T09:40:00Z', 2.71707167977236], ['2019-11-19T09:41:00Z', 7.531748826701985], ['2019-11-19T09:42:00Z', 9.060651847100033], ['2019-11-19T09:43:00Z', 7.538644905142789], ['2019-11-19T09:44:00Z', 2.6209794663899117]]}]}]}
"""


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/test_redis_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

class RedisTestCase(unittest.TestCase):
def test_ping(self):
redis = BaseRedis('10.103.64.188')
redis = BaseRedis('127.0.0.1')
print(redis.ping())

4 changes: 2 additions & 2 deletions tests/test_smtp_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def test_sendtext(self):
def test_sendattach(self):
with BaseEmail() as email:
email.sendmail(
frm="taf@gmail.com",
frm="user@domain.com",
to=["canuxcheng@gmail.com"],
cc=["canuxcheng@gmail.com"],
subject='taf test',
subject='test',
text='i am text',
files=['/home/canux/examples.desktop']
)
Expand Down

0 comments on commit 3207726

Please sign in to comment.