Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CBQE-2304 add upload test

Change-Id: I5cdef1f936a0c1652bca50cd9630f71f6dbb48a2
Reviewed-on: http://review.couchbase.org/39508
Reviewed-by: Thuan Nguyen <soccon@gmail.com>
Tested-by: Thuan Nguyen <soccon@gmail.com>
  • Loading branch information...
commit 29aef80c47adfddc35d6a5b34f0011d049449771 1 parent 2b3236d
@saigon saigon authored saigon committed
View
48 conf/py-cwc.conf
@@ -1,27 +1,27 @@
### test without upload ###
cwc.cwctests.CWCTests:
- test_start_collect_log_without_upload
- test_start_collect_log_without_upload,sasl_buckets=1
- test_start_collect_log_without_upload,sasl_buckets=1,standard_buckets=1
- test_start_collect_log_without_upload,nodes_init=4
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,standard_buckets=1
- test_start_collect_log_without_upload,nodes_init=4,collect_nodes=3
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,collect_nodes=3
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,standard_buckets=1,collect_nodes=3
- test_start_collect_log_without_upload,nodes_init=4,collect_nodes=2
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,collect_nodes=2
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,standard_buckets=1,collect_nodes=2
- test_start_collect_log_without_upload,nodes_init=4,replicas=2
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,replicas=2
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,standard_buckets=1,replicas=2
- test_start_collect_log_without_upload,nodes_init=4,replicas=2,collect_nodes=3
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,replicas=2,collect_nodes=3
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,standard_buckets=1,replicas=2,collect_nodes=3
- test_start_collect_log_without_upload,nodes_init=4,replicas=2,collect_nodes=2
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,replicas=2,collect_nodes=2
- test_start_collect_log_without_upload,nodes_init=4,sasl_buckets=1,standard_buckets=1,replicas=2,collect_nodes=2
- test_start_collect_log_without_upload,nodes_init=4,replicas=3
- test_start_collect_log_without_upload,nodes_init=4,replicas=3,collect_nodes=3
- test_start_collect_log_without_upload,nodes_init=4,replicas=3,collect_nodes=2
+ test_start_collect_log
+ test_start_collect_log,sasl_buckets=1
+ test_start_collect_log,sasl_buckets=1,standard_buckets=1
+ test_start_collect_log,nodes_init=4
+ test_start_collect_log,nodes_init=4,sasl_buckets=1
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,standard_buckets=1
+ test_start_collect_log,nodes_init=4,collect_nodes=3
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,collect_nodes=3
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,standard_buckets=1,collect_nodes=3
+ test_start_collect_log,nodes_init=4,collect_nodes=2
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,collect_nodes=2
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,standard_buckets=1,collect_nodes=2
+ test_start_collect_log,nodes_init=4,replicas=2
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,replicas=2
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,standard_buckets=1,replicas=2
+ test_start_collect_log,nodes_init=4,replicas=2,collect_nodes=3
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,replicas=2,collect_nodes=3
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,standard_buckets=1,replicas=2,collect_nodes=3
+ test_start_collect_log,nodes_init=4,replicas=2,collect_nodes=2
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,replicas=2,collect_nodes=2
+ test_start_collect_log,nodes_init=4,sasl_buckets=1,standard_buckets=1,replicas=2,collect_nodes=2
+ test_start_collect_log,nodes_init=4,replicas=3
+ test_start_collect_log,nodes_init=4,replicas=3,collect_nodes=3
+ test_start_collect_log,nodes_init=4,replicas=3,collect_nodes=2
View
2  lib/membase/api/rest_client.py
@@ -2219,7 +2219,7 @@ def is_zone_exist(self, zone_name):
return False
def start_cluster_logs_collection(self, nodes="*", upload=False,\
- uploadHost=None, customer=None, ticket=None):
+ uploadHost=None, customer="", ticket=""):
if not upload:
params = urllib.urlencode({"nodes":nodes})
else:
View
4 pytests/cwc/cwc_base.py
@@ -17,8 +17,8 @@ def setUp(self):
self.doc_ops = self.input.param("doc_ops", None)
self.upload = self.input.param("upload", False)
self.uploadHost = self.input.param("uploadHost", None)
- self.customer_id = self.input.param("customer_id", None)
- self.ticket = self.input.param("ticket", None)
+ self.customer = self.input.param("customer", "")
+ self.ticket = self.input.param("ticket", "")
self.collect_nodes = self.input.param("collect_nodes", "*")
self.shutdown_nodes = self.input.param("shutdown_nodes", None)
if self.doc_ops is not None:
View
43 pytests/cwc/cwctests.py
@@ -1,5 +1,6 @@
import time
import unittest
+import urllib
import random
import testconstants
from TestInput import TestInputSingleton
@@ -24,21 +25,29 @@ def setUp(self):
def tearDown(self):
super(CWCTests, self).tearDown()
- def test_start_collect_log_without_upload(self):
+ def test_start_collect_log(self):
rest = RestConnection(self.master)
shell = RemoteMachineShellConnection(self.master)
if "*" not in str(self.collect_nodes) and self.nodes_init > 1:
self.collect_nodes = self._generate_random_collecting_node(rest)
- status, content = rest.start_cluster_logs_collection(nodes=self.collect_nodes)
+ status, content = rest.start_cluster_logs_collection(nodes=self.collect_nodes, \
+ upload=self.upload, uploadHost=self.uploadHost, \
+ customer=self.customer, ticket=self.ticket)
if status:
- collected = self._monitor_collecting_log(rest, timeout=1200)
+ collected, uploaded = self._monitor_collecting_log(rest, timeout=1200)
if collected:
self._verify_log_file(rest)
- shell.disconnect()
+ if self.upload and uploaded:
+ self._verify_log_uploaded(rest)
+ shell.disconnect()
+ else:
+ self.fail("ERROR: {0}".format(content))
def _monitor_collecting_log(self, rest, timeout):
start_time = time.time()
end_time = start_time + timeout
+ collected = False
+ uploaded = False
progress = 0
progress, stt, perNode = rest.get_cluster_logs_collection_status()
while (progress != 100 or stt == "running") and time.time() <= end_time :
@@ -48,14 +57,18 @@ def _monitor_collecting_log(self, rest, timeout):
for node in perNode:
self.log.info("Node: {0} **** Collect status: {1}" \
.format(node, perNode[node]["status"]))
+ if "collected" in perNode[node]["status"]:
+ collected = True
+ elif "uploaded" in perNode[node]["status"]:
+ uploaded = True
self.sleep(10)
if time.time() > end_time:
self.log.error("log could not collect after {0} seconds ".format(timeout))
- return False
+ return collected, uploaded
else:
duration = time.time() - start_time
self.log.info("log collection took {0} seconds ".format(duration))
- return True
+ return collected, uploaded
def _verify_log_file(self, rest):
@@ -89,6 +102,24 @@ def _verify_log_file(self, rest):
self.fail("Cluster-wide collectinfo failed to collect log at {0}" \
.format(node_failed_to_collect))
+ def _verify_log_uploaded(self, rest):
+ node_failed_to_uploaded = []
+ progress, status, perNode = rest.get_cluster_logs_collection_status()
+ for node in perNode:
+ self.log.info("Verify log of node {0} uploaded to host: {1}" \
+ .format(node, self.uploadHost))
+ uploaded = urllib.urlopen(perNode[node]["url"]).getcode()
+ if uploaded == 200 and self.uploadHost in perNode[node]["url"]:
+ self.log.info("Log of node {0} was uploaded to {1}" \
+ .format(node, perNode[node]["url"]))
+ else:
+ node_failed_to_uploaded.append(node)
+ if not node_failed_to_uploaded:
+ return True
+ else:
+ self.fail("Cluster-wide collectinfo failed to upload log at node(s) {0}" \
+ .format(node_failed_to_uploaded))
+
def _generate_random_collecting_node(self, rest):
random_nodes = []
nodes = rest.get_nodes()
Please sign in to comment.
Something went wrong with that request. Please try again.