|
@@ -68,7 +68,7 @@ class AMSServiceCheck(Script):
|
|
|
env.set_params(params)
|
|
|
|
|
|
random_value1 = random.random()
|
|
|
- current_time = time.time()
|
|
|
+ current_time = int(time.time()) * 1000
|
|
|
metric_json = Template('smoketest_metrics.json.j2', hostname=params.hostname, random1=random_value1,
|
|
|
current_time=current_time).get_content()
|
|
|
Logger.info("Generated metrics:\n%s" % metric_json)
|
|
@@ -111,7 +111,8 @@ class AMSServiceCheck(Script):
|
|
|
"metricNames": "AMBARI_METRICS.SmokeTest.FakeMetric",
|
|
|
"appId": "amssmoketestfake",
|
|
|
"hostname": params.hostname,
|
|
|
- "startTime": 1419860000000,
|
|
|
+ "startTime": current_time - 60000,
|
|
|
+ "endTime": current_time + 61000,
|
|
|
"precision": "seconds",
|
|
|
"grouped": "false",
|
|
|
}
|
|
@@ -143,14 +144,15 @@ class AMSServiceCheck(Script):
|
|
|
return abs(f1-f2) < delta
|
|
|
|
|
|
for metrics_data in data_json["metrics"]:
|
|
|
- if (floats_eq(metrics_data["metrics"]["1419860001000"], random_value1, 0.0000001)
|
|
|
- and floats_eq(metrics_data["metrics"]["1419860002000"], current_time, 1)):
|
|
|
- Logger.info("Values %s and %s were found in response." % (random_value1, current_time))
|
|
|
+ if (str(current_time) in metrics_data["metrics"] and str(current_time + 1000) in metrics_data["metrics"]
|
|
|
+ and floats_eq(metrics_data["metrics"][str(current_time)], random_value1, 0.0000001)
|
|
|
+ and floats_eq(metrics_data["metrics"][str(current_time + 1000)], current_time, 1)):
|
|
|
+ Logger.info("Values %s and %s were found in the response." % (random_value1, current_time))
|
|
|
break
|
|
|
pass
|
|
|
else:
|
|
|
- Logger.info("Values %s and %s were not found in response." % (random_value1, current_time))
|
|
|
- raise Fail("Values %s and %s were not found in response." % (random_value1, current_time))
|
|
|
+ Logger.info("Values %s and %s were not found in the response." % (random_value1, current_time))
|
|
|
+ raise Fail("Values %s and %s were not found in the response." % (random_value1, current_time))
|
|
|
|
|
|
Logger.info("Ambari Metrics service check is finished.")
|
|
|
|