From e08ce10056f5d6415aee9dd64dc7be4698895fa9 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Thu, 3 Sep 2020 19:41:46 +0000 Subject: [PATCH] fix(run): add timestamp filter for faster test fixes #4609 --- run/logging-manual/e2e_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/run/logging-manual/e2e_test.py b/run/logging-manual/e2e_test.py index 4200d52383a..004f01f2916 100644 --- a/run/logging-manual/e2e_test.py +++ b/run/logging-manual/e2e_test.py @@ -16,6 +16,7 @@ # This test builds and deploys the two secure services # to test that they interact properly together. +import datetime import os import subprocess import time @@ -117,7 +118,11 @@ def test_end_to_end(services): time.sleep(10) # Slight delay writing to stackdriver client = logging_v2.LoggingServiceV2Client() resource_names = [f"projects/{project}"] + # We add timestamp for making the query faster. + now = datetime.datetime.now(datetime.timezone.utc) + filter_date = now - datetime.timedelta(minutes=1) filters = ( + f"timestamp>=\"{filter_date.isoformat('T')}\" " "resource.type=cloud_run_revision " "AND severity=NOTICE " f"AND resource.labels.service_name={service_name} "