GithubHelp home page GithubHelp logo

Comments (7)

flaky-bot avatar flaky-bot commented on June 10, 2024

Looks like this issue is flaky. 😟

I'm going to leave this open and stop commenting.

A human should fix and close this.


When run at the same commit (e6063de), this test passed in one build (Build Status, Sponge) and failed in another build (Build Status, Sponge).

from python-monitoring.

dandhlee avatar dandhlee commented on June 10, 2024

hey @arithmetic1728 , similar to #150 it seems like there is also a discrepancy between pochan.alert_policy.display_name from the test and [(policy.name, policy.display_name) for policy in policies] from the client seems to differ from time to time, causing these flaky tests. Please help take a look!

from python-monitoring.

flaky-bot avatar flaky-bot commented on June 10, 2024

Oops! Looks like this issue is still flaky. It failed again. 😬

I reopened the issue, but a human will need to close it again.


commit: cd1300d
buildURL: Build Status, Sponge
status: failed

Test output
capsys = <_pytest.capture.CaptureFixture object at 0x7f777e2f0e80>
pochan = 
def test_list_alert_policies(capsys, pochan):
    snippets.list_alert_policies(pochan.project_name)
    out, _ = capsys.readouterr()
    # Only check up to the first 20 characters of the display name
    # as long strings printed to the console are truncated.
  assert pochan.alert_policy.display_name[0:20] in out

E AssertionError: assert 'snippets-test-mokaqz' in 'name display_name\n---------------------------...est-tigjdnakwf\nprojects/python-docs-samples-tests-py36/alertPolicies/7501165308929258283 snippets-test-beidgwacze\n'

snippets_test.py:130: AssertionError

from python-monitoring.

parthea avatar parthea commented on June 10, 2024

I was only able to re-create this issue by modifying test_list_alert_policies() to list a newly created alert policy.

def test_list_alert_policies(capsys, pochan):

    # Create a new alert policy
    json = open("test_alert_policy.json").read()
    policy = monitoring_v3.AlertPolicy.from_json(json)
    policy.display_name = "snippets-test-" + random_name(10)
    pochan.alert_policy = pochan.alert_policy_client.create_alert_policy(
                name=pochan.project_name, alert_policy=policy
            )

    # List alert policies and look for the policy we just created
    snippets.list_alert_policies(pochan.project_name)
    out, _ = capsys.readouterr()
    # Only check up to the first 20 characters of the display name
    # as long strings printed to the console are truncated.
    assert pochan.alert_policy.display_name[0:20] in out

The above test fails locally. Adding a retry fixed the issue. See below:

def test_list_alert_policies(capsys, pochan):
    # Create a new alert policy
    json = open("test_alert_policy.json").read()
    policy = monitoring_v3.AlertPolicy.from_json(json)
    policy.display_name = "snippets-test-" + random_name(10)
    pochan.alert_policy = pochan.alert_policy_client.create_alert_policy(
                name=pochan.project_name, alert_policy=policy
            )

    # List alert policies and look for the policy we just created.
    # Query snippets.list_alert_policies() for up to 5 seconds
    # to allow the newly created policy to appear in the list.
    retry = 5 
    while retry:        
        snippets.list_alert_policies(pochan.project_name)
        out, _ = capsys.readouterr()
        # Only check up to the first 20 characters of the display name
        # as long strings printed to the console are truncated.
        if pochan.alert_policy.display_name[0:20] in out:
            break
        retry = retry - 1
        time.sleep(1)

    assert retry > 0

from python-monitoring.

flaky-bot avatar flaky-bot commented on June 10, 2024

Oops! Looks like this issue is still flaky. It failed again. 😬

I reopened the issue, but a human will need to close it again.


commit: 064f1e0
buildURL: Build Status, Sponge
status: failed

Test output
capsys = <_pytest.capture.CaptureFixture object at 0x7f2bd54d7b90>
pochan = 
def test_list_alert_policies(capsys, pochan):
    snippets.list_alert_policies(pochan.project_name)
    out, _ = capsys.readouterr()
    # Only check up to the first 20 characters of the display name
    # as long strings printed to the console are truncated.
  assert pochan.alert_policy.display_name[0:20] in out

E AssertionError: assert 'snippets-test-wcujif' in 'name display_name\n---------------------------...est-xvqznroeih\nprojects/python-docs-samples-tests-py37/alertPolicies/2404774893716709115 snippets-test-tofvuduanj\n'

snippets_test.py:130: AssertionError

from python-monitoring.

flaky-bot avatar flaky-bot commented on June 10, 2024

Oops! Looks like this issue is still flaky. It failed again. 😬

I reopened the issue, but a human will need to close it again.


commit: a942b31
buildURL: Build Status, Sponge
status: failed

Test output
capsys = <_pytest.capture.CaptureFixture object at 0x7f50cd227e10>
pochan = 
def test_list_alert_policies(capsys, pochan):
    snippets.list_alert_policies(pochan.project_name)
    out, _ = capsys.readouterr()
    # Only check up to the first 20 characters of the display name
    # as long strings printed to the console are truncated.
  assert pochan.alert_policy.display_name[0:20] in out

E AssertionError: assert 'snippets-test-xshkan' in 'name display_name\n---------------------------...est-tigjdnakwf\nprojects/python-docs-samples-tests-py36/alertPolicies/7501165308929258283 snippets-test-beidgwacze\n'

snippets_test.py:130: AssertionError

from python-monitoring.

parthea avatar parthea commented on June 10, 2024

This should be resolved with #170

from python-monitoring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.