Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

samples.snippets.v3.alerts-client.snippets_test: test_enable_alert_policies failed #150

Closed
flaky-bot bot opened this issue May 31, 2021 · 2 comments · Fixed by #157
Closed

samples.snippets.v3.alerts-client.snippets_test: test_enable_alert_policies failed #150

flaky-bot bot opened this issue May 31, 2021 · 2 comments · Fixed by #157
Assignees
Labels
api: monitoring Issues related to the googleapis/python-monitoring API. flakybot: flaky Tells the Flaky Bot not to close or comment on this issue. flakybot: issue An issue filed by the Flaky Bot. Should not be added manually. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. samples Issues that are directly related to samples. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@flaky-bot
Copy link

flaky-bot bot commented May 31, 2021

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


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

Test output
capsys = <_pytest.capture.CaptureFixture object at 0x7fa0c7aa5810>
pochan = 
@pytest.mark.flaky(rerun_filter=delay_on_aborted, max_runs=5)
def test_enable_alert_policies(capsys, pochan):
    # These sleep calls are for mitigating the following error:
    # "409 Too many concurrent edits to the project configuration.
    # Please try again."
    # Having multiple projects will void these `sleep()` calls.
    # See also #3310
    time.sleep(2)
    snippets.enable_alert_policies(pochan.project_name, True)
    out, _ = capsys.readouterr()
    assert (
        "Enabled {0}".format(pochan.project_name) in out
        or "{} is already enabled".format(pochan.alert_policy.name) in out
    )

    time.sleep(2)
    snippets.enable_alert_policies(pochan.project_name, False)
    out, _ = capsys.readouterr()
  assert (
        "Disabled {}".format(pochan.project_name) in out
        or "{} is already disabled".format(pochan.alert_policy.name) in out
    )

E assert ('Disabled projects/python-docs-samples-tests-py37' in 'Policy projects/python-docs-samples-tests-py37/alertPolicies/14818226130155215502 is already disabled\nPolicy projects/python-docs-samples-tests-py37/alertPolicies/2404774893716709115 is already disabled\n' or 'projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319 is already disabled' in 'Policy projects/python-docs-samples-tests-py37/alertPolicies/14818226130155215502 is already disabled\nPolicy projects/python-docs-samples-tests-py37/alertPolicies/2404774893716709115 is already disabled\n')
E + where 'Disabled projects/python-docs-samples-tests-py37' = <built-in method format of str object at 0x7fa0c9cebcf0>('projects/python-docs-samples-tests-py37')
E + where <built-in method format of str object at 0x7fa0c9cebcf0> = 'Disabled {}'.format
E + and 'projects/python-docs-samples-tests-py37' = <snippets_test.PochanFixture object at 0x7fa0c7bb5350>.project_name
E + and 'projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319 is already disabled' = <built-in method format of str object at 0x7fa0c9c00120>('projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319')
E + where <built-in method format of str object at 0x7fa0c9c00120> = '{} is already disabled'.format
E + and 'projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319' = name: "projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319"\ndisplay_name: "snippets-test-ugrikrch..."projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319/conditions/486425858163223454"\n}\nenabled {\n}\n.name
E + where name: "projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319"\ndisplay_name: "snippets-test-ugrikrch..."projects/python-docs-samples-tests-py37/alertPolicies/486425858163221319/conditions/486425858163223454"\n}\nenabled {\n}\n = <snippets_test.PochanFixture object at 0x7fa0c7bb5350>.alert_policy

snippets_test.py:149: AssertionError

@flaky-bot flaky-bot bot added flakybot: issue An issue filed by the Flaky Bot. Should not be added manually. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 31, 2021
@product-auto-label product-auto-label bot added api: monitoring Issues related to the googleapis/python-monitoring API. samples Issues that are directly related to samples. labels May 31, 2021
@flaky-bot flaky-bot bot added the flakybot: flaky Tells the Flaky Bot not to close or comment on this issue. label May 31, 2021
@flaky-bot
Copy link
Author

flaky-bot bot commented May 31, 2021

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).

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Jun 5, 2021
@dandhlee dandhlee assigned dandhlee and arithmetic1728 and unassigned dandhlee Jun 6, 2021
@dandhlee
Copy link
Contributor

dandhlee commented Jun 6, 2021

hey @arithmetic1728, it seems like policy.name that enable_alert_policies function returns sometimes differs from the pochan.alert_policy.name that the tests expect, and I can't figure out why there could be a discrepancy here as I'm not too familiar with the product. Please help take a look or help find someone who can take a better look 😅

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jun 8, 2021
@parthea parthea self-assigned this Jun 17, 2021
gcf-merge-on-green bot pushed a commit that referenced this issue Jun 18, 2021
…ies (#157)

This PR attempts to resolve #150 by only enabling/ disabling a single alert policy, rather than enabling/ disabling all alert polices in the specified project in order to reduce the output that we need to parse for the expected result. From the build log in #150 :`'"snippets-test-ugrikrch..."projects/python-docs-samples-tests-py37'`, the `...` indicates that information is being truncated which would cause flaky results. 

Fixes #150 🦕
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: monitoring Issues related to the googleapis/python-monitoring API. flakybot: flaky Tells the Flaky Bot not to close or comment on this issue. flakybot: issue An issue filed by the Flaky Bot. Should not be added manually. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. samples Issues that are directly related to samples. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
4 participants