Skip to content

Commit

Permalink
test is fail with leak
Browse files Browse the repository at this point in the history
Signed-off-by: Bezalel Brandwine <[email protected]>
  • Loading branch information
Bezalel Brandwine committed Nov 27, 2023
1 parent 4322e94 commit 058a498
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions system-tests/load_10k_alerts_no_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def load_10k_alerts_no_memory_leak(namespace="kubecop-test"):
nginx_pod_name = subprocess.check_output(["kubectl", "-n", namespace , "get", "pod", "-l", "app=nginx", "-o", "jsonpath='{.items[0].metadata.name}'"]).decode("utf-8").strip("'")
time_start = time.time()
# Exec into the nginx pod 10k times
for i in range(10):
for i in range(10000):
subprocess.check_call(["kubectl", "-n", namespace , "exec", nginx_pod_name, "--", "touch", "/tmp/nginx-test"])
if i%1000 == 0:
print("Executed %s times"%i)


# wait for 60 seconds so the memory leak can be detected
# time.sleep(60)
time.sleep(60)

# Get kubecop pod name
kc_pod_name = subprocess.check_output(["kubectl", "-n", "kubescape", "get", "pods", "-l", "app.kubernetes.io/name=kubecop", "-o", "jsonpath='{.items[0].metadata.name}'"], universal_newlines=True).strip("'")
Expand Down
4 changes: 2 additions & 2 deletions system-tests/promtopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def send_promql_query_to_prom(test_case_name, query, time_start, time_end, steps
# Example of processing and plotting
# This will vary greatly depending on the shape of your data
assert len(data) > 0, "No data found in prometheus when looking for %s" % test_case_name
timestamps = [datetime.fromtimestamp(item[0]).strftime("%M:%S") for item in data[1]['values']] # Assuming the first result and it's a time series
values = [float(item[1]) for item in data[1]['values']]
timestamps = [datetime.fromtimestamp(item[0]).strftime("%M:%S") for item in data[0]['values']] # Assuming the first result and it's a time series
values = [float(item[1]) for item in data[0]['values']]
return timestamps, values


Expand Down

0 comments on commit 058a498

Please sign in to comment.