diff --git a/logtools/log/sources/input/elastic_search/elastic_search_log_repo.py b/logtools/log/sources/input/elastic_search/elastic_search_log_repo.py index 637a757..0e4e611 100644 --- a/logtools/log/sources/input/elastic_search/elastic_search_log_repo.py +++ b/logtools/log/sources/input/elastic_search/elastic_search_log_repo.py @@ -1,8 +1,10 @@ import logging from dataclasses import dataclass -from datetime import datetime +from datetime import datetime, timedelta +from enum import Enum from typing import Optional, Iterator, Dict, Any +from dateutil import parser from elasticsearch import Elasticsearch logger = logging.getLogger(__name__) @@ -23,14 +25,35 @@ class Pod: indices: tuple[str, ...] +class TestStatus(Enum): + passed = 'passed' + failed = 'failed' + + +@dataclass(frozen=True) +class TestRun: + id: str + run_id: str + test_name: str + pods: str + start: datetime + end: datetime + duration: float + status: TestStatus + error: Optional[str] + stacktrace: Optional[str] + + MAX_AGGREGATION_BUCKETS = 1000 +POD_LOGS_INDEX_SET = 'continuous-tests-pods-*' +TEST_STATUS_INDEX_SET = 'continuous-tests-status-*' + class ElasticSearchLogRepo: def __init__( self, client: Optional[Elasticsearch] = None, - indices: str = 'continuous-tests-pods-*', since: Optional[datetime] = None, ): if client is None: @@ -38,7 +61,6 @@ class ElasticSearchLogRepo: client = Elasticsearch(hosts='http://localhost:9200', request_timeout=60) self.client = client - self.indices = indices self.since = since def namespaces(self, prefix: Optional[str] = None) -> Iterator[Namespace]: @@ -58,7 +80,7 @@ class ElasticSearchLogRepo: if prefix is not None: query['aggs']['distinct_namespaces']['terms']['include'] = f'{prefix}.*' # type: ignore - result = self.client.search(index=self.indices, body=query) # type: ignore + result = self.client.search(index=POD_LOGS_INDEX_SET, body=query) # type: ignore for namespace in result['aggregations']['distinct_namespaces']['buckets']: yield Namespace( @@ -92,7 +114,7 @@ class ElasticSearchLogRepo: } } - for pod in self.client.search(index=self.indices, + for pod in self.client.search(index=POD_LOGS_INDEX_SET, body=query)['aggregations']['distinct_pods']['buckets']: # type: ignore assert len(pod['namespace']['buckets']) == 1, 'Pods should only have one namespace' assert len(pod['runid']['buckets']) == 1, 'Pods should only have one run_id' @@ -104,6 +126,37 @@ class ElasticSearchLogRepo: indices=tuple(sorted(index['key'] for index in pod['indices']['buckets'])) ) + def test_runs(self, run_id: str, failed_only=False) -> Iterator[TestRun]: + query = self._time_limited({ + 'query': { + 'bool': { + 'filter': [{'term': {'runid.keyword': run_id}}] + } + }, + 'sort': [{'@timestamp': 'desc'}], + 'size': 10000, + }) + + if failed_only: + query['query']['bool']['filter'].append({'term': {'status.keyword': 'Failed'}}) + + for document in self.client.search(index=TEST_STATUS_INDEX_SET, body=query)['hits']['hits']: # type: ignore + content = document['_source'] + start = parser.parse(content['teststart']) + duration = float(content['testduration']) + yield TestRun( + id=document['_id'], + run_id=content['runid'], + test_name=content['testname'], + start=start, + end=start + timedelta(seconds=duration), + duration=duration, + status=TestStatus(content['status'].lower()), + pods=content['involvedpods'], + error=content.get('error'), + stacktrace=content.get('message') + ) + def _time_limited(self, query: Dict[str, Any]) -> Dict[str, Any]: if self.since is not None: query['query'] = { diff --git a/logtools/log/sources/input/elastic_search/tests/cassettes/test_elasticsearch_log_repo/test_should_retrieve_failing_test_runs_over_a_single_run_id.yaml b/logtools/log/sources/input/elastic_search/tests/cassettes/test_elasticsearch_log_repo/test_should_retrieve_failing_test_runs_over_a_single_run_id.yaml new file mode 100644 index 0000000..e2bf1f7 --- /dev/null +++ b/logtools/log/sources/input/elastic_search/tests/cassettes/test_elasticsearch_log_repo/test_should_retrieve_failing_test_runs_over_a_single_run_id.yaml @@ -0,0 +1,242 @@ +interactions: +- request: + body: '{"query":{"bool":{"filter":[{"term":{"runid.keyword":"20240206-093136"}},{"term":{"status.keyword":"Failed"}}]}},"size":10000,"sort":[{"@timestamp":"desc"}]}' + headers: + accept: + - application/vnd.elasticsearch+json; compatible-with=8 + connection: + - keep-alive + content-type: + - application/vnd.elasticsearch+json; compatible-with=8 + user-agent: + - elasticsearch-py/8.10.1 (Python/3.11.5; elastic-transport/8.10.0) + x-elastic-client-meta: + - es=8.10.1,py=3.11.5,t=8.10.0,ur=2.0.7 + method: POST + uri: http://localhost:9200/continuous-tests-status-*/_search + response: + body: + string: '{"took":4,"timed_out":false,"_shards":{"total":23,"successful":23,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":null,"hits":[{"_index":"continuous-tests-status-2024.02.07","_id":"t5apg40BTe2pYqi1l9b8","_score":null,"_ignored":["message.keyword"],"_source":{"@timestamp":"2024-02-06T23:07:39.6615501Z","avgupload":"297.8KB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":" data/zDvZRwzm5UemKDPMvadCu999HrqUnCJGzvKnsF7eiy2XV3TzoW7V/network'' + timed out after 3 tries over 10 mins, 1 secs.","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"System.Exception: + System.TimeoutException: Retry ''HTTP-GET-STREAM: data/zDvZRwzm5UemKDPMvadCu999HrqUnCJGzvKnsF7eiy2XV3TzoW7V/network'' + timed out after 3 tries over 10 mins, 1 secs.\n ---> System.AggregateException: + One or more errors occurred. (One or more errors occurred. (A task was canceled.)) + (One or more errors occurred. (A task was canceled.)) (One or more errors + occurred. (A task was canceled.)) (One or more errors occurred. (Connection + refused (bootstrap-2-2-int.two-client-test-bugfix.svc.cluster.local:30014)))\n + ---> System.AggregateException: One or more errors occurred. (A task was canceled.)\n + ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.\n at + System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)\n at + System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\n at + System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken + cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at Utils.Time.Wait[T](Task`1 + task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 12\n at Core.Http.<>c__DisplayClass15_0.b__0() + in /cs-codex-dist-tests/Framework/Core/Http.cs:line 125\n at Utils.Time.Retry[T](Func`1 + action, Int32 maxRetries, TimeSpan retryTime, String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 144\n at Core.Http.LockRetry[T](Func`1 operation, String description) in + /cs-codex-dist-tests/Framework/Core/Http.cs:line 212\n at Core.Http.HttpGetStream(String + route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line 120\n at CodexPlugin.CodexAccess.DownloadFile(String + contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, + BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n at + ContinuousTests.TestHandle.InvokeMoment(Int32 currentMoment, Action`1 beforeInvoke) + in /cs-codex-dist-tests/Tests/CodexContinuousTests/TestHandle.cs:line 47\n at + ContinuousTests.SingleTestRun.RunMoment(Int32 t) in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 250\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 150\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76\n at + ContinuousTests.SingleTestRun.<>c__DisplayClass13_0.b__0() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 53\n at Utils.TaskFactory.CatchException(Action action, String name) in + /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 20\n at Utils.TaskFactory.<>c__DisplayClass2_0.b__0() + in /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 12\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread + threadPoolThread, ExecutionContext executionContext, ContextCallback callback, + Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& + currentTaskSlot, Thread threadPoolThread)\n at System.Threading.ThreadPoolWorkQueue.Dispatch()\n at + System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()\n--- + End of stack trace from previous location ---\n\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144\n --- + End of inner exception stack trace ---\n ---> (Inner Exception #1) System.AggregateException: + One or more errors occurred. (A task was canceled.)\n ---> System.Threading.Tasks.TaskCanceledException: + A task was canceled.\n at System.Threading.Tasks.Task.GetExceptions(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144\n at + Core.Http.LockRetry[T](Func`1 operation, String description) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 212\n at Core.Http.HttpGetStream(String route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 120\n at CodexPlugin.CodexAccess.DownloadFile(String contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, + BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n at + ContinuousTests.TestHandle.InvokeMoment(Int32 currentMoment, Action`1 beforeInvoke) + in /cs-codex-dist-tests/Tests/CodexContinuousTests/TestHandle.cs:line 47\n at + ContinuousTests.SingleTestRun.RunMoment(Int32 t) in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 250\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 150\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76\n at + ContinuousTests.SingleTestRun.<>c__DisplayClass13_0.b__0() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 53\n at Utils.TaskFactory.CatchException(Action action, String name) in + /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 20\n at Utils.TaskFactory.<>c__DisplayClass2_0.b__0() + in /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 12\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread + threadPoolThread, ExecutionContext executionContext, ContextCallback callback, + Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& + currentTaskSlot, Thread threadPoolThread)\n at System.Threading.ThreadPoolWorkQueue.Dispatch()\n at + System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()\n--- + End of stack trace from previous location ---\n\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144<---\n\n + ---> (Inner Exception #2) System.AggregateException: One or more errors occurred. + (A task was canceled.)\n ---> System.Threading.Tasks.TaskCanceledException: + A task was canceled.\n at System.Threading.Tasks.Task.GetExceptions(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144\n at + Core.Http.LockRetry[T](Func`1 operation, String description) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 212\n at Core.Http.HttpGetStream(String route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 120\n at CodexPlugin.CodexAccess.DownloadFile(String contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, + BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n at + ContinuousTests.TestHandle.InvokeMoment(Int32 currentMoment, Action`1 beforeInvoke) + in /cs-codex-dist-tests/Tests/CodexContinuousTests/TestHandle.cs:line 47\n at + ContinuousTests.SingleTestRun.RunMoment(Int32 t) in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 250\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 150\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76\n at + ContinuousTests.SingleTestRun.<>c__DisplayClass13_0.b__0() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 53\n at Utils.TaskFactory.CatchException(Action action, String name) in + /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 20\n at Utils.TaskFactory.<>c__DisplayClass2_0.b__0() + in /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 12\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread + threadPoolThread, ExecutionContext executionContext, ContextCallback callback, + Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& + currentTaskSlot, Thread threadPoolThread)\n at System.Threading.ThreadPoolWorkQueue.Dispatch()\n at + System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()\n--- + End of stack trace from previous location ---\n\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144<---\n\n + ---> (Inner Exception #3) System.AggregateException: One or more errors occurred. + (Connection refused (bootstrap-2-2-int.two-client-test-bugfix.svc.cluster.local:30014))\n + ---> System.Net.Http.HttpRequestException: Connection refused (bootstrap-2-2-int.two-client-test-bugfix.svc.cluster.local:30014)\n + ---> System.Net.Sockets.SocketException (111): Connection refused\n at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError + error, CancellationToken cancellationToken)\n at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 + token)\n at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs + saea, ValueTask connectTask, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String + host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken + cancellationToken)\n --- End of inner exception stack trace ---\n at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String + host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken + cancellationToken)\n at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage + request, Boolean async, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage + request, Boolean async, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem + queueItem)\n at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken + cancellationToken)\n at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean + async, CancellationToken requestCancellationToken)\n at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage + request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)\n at + System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean + async, CancellationToken cancellationToken)\n at System.Net.Http.HttpClient.GetStreamAsyncCore(HttpRequestMessage + request, CancellationToken cancellationToken)\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144<---\n\n --- + End of inner exception stack trace ---\n at Utils.Time.Retry[T](Func`1 action, + Int32 maxRetries, TimeSpan retryTime, String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 139\n at Core.Http.LockRetry[T](Func`1 operation, String description) in + /cs-codex-dist-tests/Framework/Core/Http.cs:line 212\n at Core.Http.HttpGetStream(String + route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line 120\n at CodexPlugin.CodexAccess.DownloadFile(String + contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at ContinuousTests.SingleTestRun.ThrowFailTest() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 186\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 155\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Failed","testduration":"0","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T22:52:53.0881883Z","testtype":"continuous-tests"},"sort":[1707260859661]}]}}' + headers: + Transfer-Encoding: + - chunked + X-elastic-product: + - Elasticsearch + content-type: + - application/vnd.elasticsearch+json;compatible-with=8 + status: + code: 200 + message: OK +version: 1 diff --git a/logtools/log/sources/input/elastic_search/tests/cassettes/test_elasticsearch_log_repo/test_should_retrieve_test_runs_over_a_single_run_id.yaml b/logtools/log/sources/input/elastic_search/tests/cassettes/test_elasticsearch_log_repo/test_should_retrieve_test_runs_over_a_single_run_id.yaml new file mode 100644 index 0000000..d0da8a7 --- /dev/null +++ b/logtools/log/sources/input/elastic_search/tests/cassettes/test_elasticsearch_log_repo/test_should_retrieve_test_runs_over_a_single_run_id.yaml @@ -0,0 +1,255 @@ +interactions: +- request: + body: '{"query":{"bool":{"filter":[{"term":{"runid.keyword":"20240206-093136"}}]}},"size":10000,"sort":[{"@timestamp":"desc"}]}' + headers: + accept: + - application/vnd.elasticsearch+json; compatible-with=8 + connection: + - keep-alive + content-type: + - application/vnd.elasticsearch+json; compatible-with=8 + user-agent: + - elasticsearch-py/8.10.1 (Python/3.11.5; elastic-transport/8.10.0) + x-elastic-client-meta: + - es=8.10.1,py=3.11.5,t=8.10.0,ur=2.0.7 + method: POST + uri: http://localhost:9200/continuous-tests-status-*/_search + response: + body: + string: '{"took":13,"timed_out":false,"_shards":{"total":23,"successful":23,"skipped":0,"failed":0},"hits":{"total":{"value":14,"relation":"eq"},"max_score":null,"hits":[{"_index":"continuous-tests-status-2024.02.07","_id":"t5apg40BTe2pYqi1l9b8","_score":null,"_ignored":["message.keyword"],"_source":{"@timestamp":"2024-02-06T23:07:39.6615501Z","avgupload":"297.8KB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":" data/zDvZRwzm5UemKDPMvadCu999HrqUnCJGzvKnsF7eiy2XV3TzoW7V/network'' + timed out after 3 tries over 10 mins, 1 secs.","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"System.Exception: + System.TimeoutException: Retry ''HTTP-GET-STREAM: data/zDvZRwzm5UemKDPMvadCu999HrqUnCJGzvKnsF7eiy2XV3TzoW7V/network'' + timed out after 3 tries over 10 mins, 1 secs.\n ---> System.AggregateException: + One or more errors occurred. (One or more errors occurred. (A task was canceled.)) + (One or more errors occurred. (A task was canceled.)) (One or more errors + occurred. (A task was canceled.)) (One or more errors occurred. (Connection + refused (bootstrap-2-2-int.two-client-test-bugfix.svc.cluster.local:30014)))\n + ---> System.AggregateException: One or more errors occurred. (A task was canceled.)\n + ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.\n at + System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)\n at + System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\n at + System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken + cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at Utils.Time.Wait[T](Task`1 + task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 12\n at Core.Http.<>c__DisplayClass15_0.b__0() + in /cs-codex-dist-tests/Framework/Core/Http.cs:line 125\n at Utils.Time.Retry[T](Func`1 + action, Int32 maxRetries, TimeSpan retryTime, String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 144\n at Core.Http.LockRetry[T](Func`1 operation, String description) in + /cs-codex-dist-tests/Framework/Core/Http.cs:line 212\n at Core.Http.HttpGetStream(String + route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line 120\n at CodexPlugin.CodexAccess.DownloadFile(String + contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, + BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n at + ContinuousTests.TestHandle.InvokeMoment(Int32 currentMoment, Action`1 beforeInvoke) + in /cs-codex-dist-tests/Tests/CodexContinuousTests/TestHandle.cs:line 47\n at + ContinuousTests.SingleTestRun.RunMoment(Int32 t) in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 250\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 150\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76\n at + ContinuousTests.SingleTestRun.<>c__DisplayClass13_0.b__0() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 53\n at Utils.TaskFactory.CatchException(Action action, String name) in + /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 20\n at Utils.TaskFactory.<>c__DisplayClass2_0.b__0() + in /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 12\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread + threadPoolThread, ExecutionContext executionContext, ContextCallback callback, + Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& + currentTaskSlot, Thread threadPoolThread)\n at System.Threading.ThreadPoolWorkQueue.Dispatch()\n at + System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()\n--- + End of stack trace from previous location ---\n\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144\n --- + End of inner exception stack trace ---\n ---> (Inner Exception #1) System.AggregateException: + One or more errors occurred. (A task was canceled.)\n ---> System.Threading.Tasks.TaskCanceledException: + A task was canceled.\n at System.Threading.Tasks.Task.GetExceptions(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144\n at + Core.Http.LockRetry[T](Func`1 operation, String description) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 212\n at Core.Http.HttpGetStream(String route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 120\n at CodexPlugin.CodexAccess.DownloadFile(String contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, + BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n at + ContinuousTests.TestHandle.InvokeMoment(Int32 currentMoment, Action`1 beforeInvoke) + in /cs-codex-dist-tests/Tests/CodexContinuousTests/TestHandle.cs:line 47\n at + ContinuousTests.SingleTestRun.RunMoment(Int32 t) in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 250\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 150\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76\n at + ContinuousTests.SingleTestRun.<>c__DisplayClass13_0.b__0() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 53\n at Utils.TaskFactory.CatchException(Action action, String name) in + /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 20\n at Utils.TaskFactory.<>c__DisplayClass2_0.b__0() + in /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 12\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread + threadPoolThread, ExecutionContext executionContext, ContextCallback callback, + Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& + currentTaskSlot, Thread threadPoolThread)\n at System.Threading.ThreadPoolWorkQueue.Dispatch()\n at + System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()\n--- + End of stack trace from previous location ---\n\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144<---\n\n + ---> (Inner Exception #2) System.AggregateException: One or more errors occurred. + (A task was canceled.)\n ---> System.Threading.Tasks.TaskCanceledException: + A task was canceled.\n at System.Threading.Tasks.Task.GetExceptions(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144\n at + Core.Http.LockRetry[T](Func`1 operation, String description) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 212\n at Core.Http.HttpGetStream(String route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 120\n at CodexPlugin.CodexAccess.DownloadFile(String contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, + BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n at + ContinuousTests.TestHandle.InvokeMoment(Int32 currentMoment, Action`1 beforeInvoke) + in /cs-codex-dist-tests/Tests/CodexContinuousTests/TestHandle.cs:line 47\n at + ContinuousTests.SingleTestRun.RunMoment(Int32 t) in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 250\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 150\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76\n at + ContinuousTests.SingleTestRun.<>c__DisplayClass13_0.b__0() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 53\n at Utils.TaskFactory.CatchException(Action action, String name) in + /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 20\n at Utils.TaskFactory.<>c__DisplayClass2_0.b__0() + in /cs-codex-dist-tests/Framework/Utils/TaskFactory.cs:line 12\n at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread + threadPoolThread, ExecutionContext executionContext, ContextCallback callback, + Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& + currentTaskSlot, Thread threadPoolThread)\n at System.Threading.ThreadPoolWorkQueue.Dispatch()\n at + System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()\n--- + End of stack trace from previous location ---\n\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144<---\n\n + ---> (Inner Exception #3) System.AggregateException: One or more errors occurred. + (Connection refused (bootstrap-2-2-int.two-client-test-bugfix.svc.cluster.local:30014))\n + ---> System.Net.Http.HttpRequestException: Connection refused (bootstrap-2-2-int.two-client-test-bugfix.svc.cluster.local:30014)\n + ---> System.Net.Sockets.SocketException (111): Connection refused\n at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError + error, CancellationToken cancellationToken)\n at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 + token)\n at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs + saea, ValueTask connectTask, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String + host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken + cancellationToken)\n --- End of inner exception stack trace ---\n at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String + host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken + cancellationToken)\n at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage + request, Boolean async, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage + request, Boolean async, CancellationToken cancellationToken)\n at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem + queueItem)\n at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken + cancellationToken)\n at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean + async, CancellationToken requestCancellationToken)\n at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage + request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)\n at + System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean + async, CancellationToken cancellationToken)\n at System.Net.Http.HttpClient.GetStreamAsyncCore(HttpRequestMessage + request, CancellationToken cancellationToken)\n --- End of inner exception + stack trace ---\n at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean + includeTaskCanceledExceptions)\n at System.Threading.Tasks.Task.Wait(Int32 + millisecondsTimeout, CancellationToken cancellationToken)\n at System.Threading.Tasks.Task.Wait()\n at + Utils.Time.Wait[T](Task`1 task) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 12\n at Core.Http.<>c__DisplayClass15_0.b__0() in /cs-codex-dist-tests/Framework/Core/Http.cs:line + 125\n at Utils.Time.Retry[T](Func`1 action, Int32 maxRetries, TimeSpan retryTime, + String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line 144<---\n\n --- + End of inner exception stack trace ---\n at Utils.Time.Retry[T](Func`1 action, + Int32 maxRetries, TimeSpan retryTime, String description) in /cs-codex-dist-tests/Framework/Utils/Time.cs:line + 139\n at Core.Http.LockRetry[T](Func`1 operation, String description) in + /cs-codex-dist-tests/Framework/Core/Http.cs:line 212\n at Core.Http.HttpGetStream(String + route) in /cs-codex-dist-tests/Framework/Core/Http.cs:line 120\n at CodexPlugin.CodexAccess.DownloadFile(String + contentId) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexAccess.cs:line + 71\n at CodexPlugin.CodexNode.DownloadToFile(String contentId, TrackedFile + file) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 200\n at CodexPlugin.CodexNode.<>c__DisplayClass35_0.b__0() + in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line 128\n at + Logging.Stopwatch.Measure(ILog log, String name, Action action, Boolean debug) + in /cs-codex-dist-tests/Framework/Logging/Stopwatch.cs:line 22\n at CodexPlugin.CodexNode.DownloadContent(ContentId + contentId, String fileLabel) in /cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexNode.cs:line + 128\n at ContinuousTests.Tests.TwoClientTest.<>c__DisplayClass11_0.b__0() + in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at ContinuousTests.Tests.TwoClientTest.LogBytesPerMillisecond(Action + action) in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 82\n at ContinuousTests.Tests.TwoClientTest.DownloadTestFile() in /cs-codex-dist-tests/Tests/CodexContinuousTests/Tests/TwoClientTest.cs:line + 43\n at InvokeStub_TwoClientTest.DownloadTestFile(Object, Object, IntPtr*)\n at + System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags + invokeAttr)\n at ContinuousTests.SingleTestRun.ThrowFailTest() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 186\n at ContinuousTests.SingleTestRun.RunTestMoments() in /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line + 155\n at ContinuousTests.SingleTestRun.RunTest(Action`1 resultHandler) in + /cs-codex-dist-tests/Tests/CodexContinuousTests/SingleTestRun.cs:line 76","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Failed","testduration":"0","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T22:52:53.0881883Z","testtype":"continuous-tests"},"sort":[1707260859661]},{"_index":"continuous-tests-status-2024.02.07","_id":"tpapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T22:52:52.2996375Z","avgdownload":"780.8KB/s","avgupload":"3MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"141.9114191","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T22:50:30.3878431Z","testtype":"continuous-tests"},"sort":[1707259972299]},{"_index":"continuous-tests-status-2024.02.07","_id":"sZapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T22:50:30.0675681Z","avgdownload":"152.9KB/s","avgupload":"3.1MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"572.9451525","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T22:40:57.1222113Z","testtype":"continuous-tests"},"sort":[1707259830067]},{"_index":"continuous-tests-status-2024.02.07","_id":"sJapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T22:40:56.1120614Z","avgdownload":"70KB/s","avgupload":"3.1MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"1207.5289232","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T22:20:48.5829991Z","testtype":"continuous-tests"},"sort":[1707259256112]},{"_index":"continuous-tests-status-2024.02.07","_id":"r5apg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T22:20:47.5015704Z","avgdownload":"107KB/s","avgupload":"2.9MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"804.6780181","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T22:07:22.8233627Z","testtype":"continuous-tests"},"sort":[1707258047501]},{"_index":"continuous-tests-status-2024.02.07","_id":"rpapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T22:07:13.1890259Z","avgdownload":"1.2MB/s","avgupload":"2.5MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"113.1299709","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T22:05:20.0552568Z","testtype":"continuous-tests"},"sort":[1707257233189]},{"_index":"continuous-tests-status-2024.02.07","_id":"qJapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T22:05:19.1233015Z","avgdownload":"128.4KB/s","avgupload":"2.3MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"683.6157221","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:53:55.5063178Z","testtype":"continuous-tests"},"sort":[1707257119123]},{"_index":"continuous-tests-status-2024.02.07","_id":"p5apg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T21:53:47.1782269Z","avgdownload":"1MB/s","avgupload":"3.4MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"113.2005889","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:51:53.9774688Z","testtype":"continuous-tests"},"sort":[1707256427178]},{"_index":"continuous-tests-status-2024.02.07","_id":"ppapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T21:51:45.5038683Z","avgdownload":"988.9KB/s","avgupload":"4.2MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"112.4111551","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:49:53.0925544Z","testtype":"continuous-tests"},"sort":[1707256305503]},{"_index":"continuous-tests-status-2024.02.07","_id":"pZapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T21:49:11.8557349Z","avgdownload":"1.8MB/s","avgupload":"3.3MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"78.958915","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:47:52.8966341Z","testtype":"continuous-tests"},"sort":[1707256151855]},{"_index":"continuous-tests-status-2024.02.07","_id":"mpapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T21:47:33.8366307Z","avgdownload":"1.1MB/s","avgupload":"4.3MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"101.1595982","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:45:52.6769016Z","testtype":"continuous-tests"},"sort":[1707256053836]},{"_index":"continuous-tests-status-2024.02.07","_id":"mZapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T21:45:08.0812184Z","avgdownload":"1.7MB/s","avgupload":"4.1MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"75.6624344","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:43:52.4185559Z","testtype":"continuous-tests"},"sort":[1707255908081]},{"_index":"continuous-tests-status-2024.02.07","_id":"mJapg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T21:43:14.2974430Z","avgdownload":"1.8MB/s","avgupload":"3.1MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"82.0906635","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:41:52.2061498Z","testtype":"continuous-tests"},"sort":[1707255794297]},{"_index":"continuous-tests-status-2024.02.07","_id":"l5apg40BTe2pYqi1l9b8","_score":null,"_source":{"@timestamp":"2024-02-06T21:41:05.3802809Z","avgdownload":"1.8MB/s","avgupload":"4.4MB/s","category":"none","codexcontractsid":"codexstorage/codex-contracts-eth:sha-b5f3399-dist-tests","codexid":"untagged + build","codexrevision":"6869475","error":"OK","fixturename":"none","gethid":"codexstorage/dist-tests-geth:latest","involvedpods":",","message":"OK","prometheusid":"codexstorage/dist-tests-prometheus:latest","runid":"20240206-093136","status":"Passed","testduration":"73.3825081","testframeworkrevision":"c3eeb0b","testid":"EnvVar-TESTID-NotSet","testname":"TwoClientTest","teststart":"2024-02-06T21:39:51.9897720Z","testtype":"continuous-tests"},"sort":[1707255665380]}]}}' + headers: + Transfer-Encoding: + - chunked + X-elastic-product: + - Elasticsearch + content-type: + - application/vnd.elasticsearch+json;compatible-with=8 + status: + code: 200 + message: OK +version: 1 diff --git a/logtools/log/sources/input/elastic_search/tests/test_elasticsearch_log_repo.py b/logtools/log/sources/input/elastic_search/tests/test_elasticsearch_log_repo.py index f5bd921..fa4a80f 100644 --- a/logtools/log/sources/input/elastic_search/tests/test_elasticsearch_log_repo.py +++ b/logtools/log/sources/input/elastic_search/tests/test_elasticsearch_log_repo.py @@ -78,3 +78,23 @@ def test_should_respect_time_horizon_for_retrieving_resources(): namespaces = repo.namespaces('codex-continuous-tests-profiling') assert len(list(namespaces)) == 2 + + +@pytest.mark.vcr +def test_should_retrieve_test_runs_over_a_single_run_id(): + repo = ElasticSearchLogRepo() + runs = list(repo.test_runs('20240206-093136')) + + assert len(runs) == 14 + + +@pytest.mark.vcr +def test_should_retrieve_failing_test_runs_over_a_single_run_id(): + repo = ElasticSearchLogRepo() + runs = list(repo.test_runs('20240206-093136', failed_only=True)) + + assert len(runs) == 1 + assert runs[0].error.strip() == ( + "data/zDvZRwzm5UemKDPMvadCu999HrqUnCJGzvKnsF7eiy2XV3TzoW7V/network' timed out after " + "3 tries over 10 mins, 1 secs." + )