From 4b51400bc393bc6a3152b19ab076b05cce0bddd1 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Fri, 29 Apr 2022 03:00:02 -0700 Subject: [PATCH] ci: try to stop channel again before deleting it in the test (#36) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Try to stop channel again before deleting it in the test. * docs(samples): try to stop channel again before deleting it in the test. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- video/live-stream/channel_test.py | 8 ++++++++ video/live-stream/input_test.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/video/live-stream/channel_test.py b/video/live-stream/channel_test.py index a7cfacdbcc37..2d9e890c65b9 100644 --- a/video/live-stream/channel_test.py +++ b/video/live-stream/channel_test.py @@ -69,6 +69,14 @@ def test_channel_operations(capsys: pytest.fixture) -> None: delete_channel.delete_channel( project_name, location, next_channel_id ) + except FailedPrecondition as e: + print(f"Ignoring FailedPrecondition, try to stop channel: {e}") + try: + stop_channel.stop_channel( + project_name, location, next_channel_id + ) + except FailedPrecondition as e: + print(f"Ignoring FailedPrecondition, details: {e}") except NotFound as e: print(f"Ignoring NotFound, details: {e}") except NotFound as e: diff --git a/video/live-stream/input_test.py b/video/live-stream/input_test.py index 21ad23f38e16..a0224b4f4d56 100644 --- a/video/live-stream/input_test.py +++ b/video/live-stream/input_test.py @@ -15,7 +15,7 @@ import os import uuid -from google.api_core.exceptions import NotFound +from google.api_core.exceptions import FailedPrecondition, NotFound import pytest import create_input @@ -38,6 +38,8 @@ def test_input_operations(capsys: pytest.fixture) -> None: if utils.is_resource_stale(response.create_time): try: delete_input.delete_input(project_name, location, next_input_id) + except FailedPrecondition as e: + print(f"Ignoring FailedPrecondition, details: {e}") except NotFound as e: print(f"Ignoring NotFound, details: {e}")