{"action":"created","issue":{"url":"https://api.github.com/repos/spulec/moto/issues/1506","repository_url":"https://api.github.com/repos/spulec/moto","labels_url":"https://api.github.com/repos/spulec/moto/issues/1506/labels{/name}","comments_url":"https://api.github.com/repos/spulec/moto/issues/1506/comments","events_url":"https://api.github.com/repos/spulec/moto/issues/1506/events","html_url":"https://github.com/spulec/moto/issues/1506","id":303691197,"number":1506,"title":"Impossible to test Redshift cluster_restored waiters","user":{"login":"ahill-mlft","id":22774119,"avatar_url":"https://avatars0.githubusercontent.com/u/22774119?v=4","gravatar_id":"","url":"https://api.github.com/users/ahill-mlft","html_url":"https://github.com/ahill-mlft","followers_url":"https://api.github.com/users/ahill-mlft/followers","following_url":"https://api.github.com/users/ahill-mlft/following{/other_user}","gists_url":"https://api.github.com/users/ahill-mlft/gists{/gist_id}","starred_url":"https://api.github.com/users/ahill-mlft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahill-mlft/subscriptions","organizations_url":"https://api.github.com/users/ahill-mlft/orgs","repos_url":"https://api.github.com/users/ahill-mlft/repos","events_url":"https://api.github.com/users/ahill-mlft/events{/privacy}","received_events_url":"https://api.github.com/users/ahill-mlft/received_events","type":"User","site_admin":false},"labels":[{"id":28886780,"url":"https://api.github.com/repos/spulec/moto/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-09T01:20:18Z","updated_at":"2018-04-25T00:43:59Z","closed_at":null,"author_association":"NONE","body":"Let us suppose we have this code:\r\n\r\n```\r\n# snap_restorer.py\r\ndef restore_snapshot(redshift_client, snapshot_id):\r\n    cluster_identifier = 'temp_' + snapshot_id\r\n    redshift_client.restore_from_cluster_snapshot(\r\n        ClusterIdentifier=cluster_identifier,\r\n        SnapshotIdentifier=snapshot_id,\r\n    )\r\n    redshift_client.get_waiter('cluster_restored').wait(\r\n        ClusterIdentifier=cluster_identifier,\r\n        WaiterConfig={\r\n            'Delay': 1,\r\n            'MaxAttempts': 2,\r\n        }\r\n    )\r\n```\r\n\r\nAnd we wish to test it like so:\r\n\r\n```\r\n# test_snap_restorer.py\r\nimport boto3\r\nfrom moto import mock_redshift\r\n\r\nfrom snap_restorer import restore_snapshot\r\n\r\n@mock_redshift\r\ndef test_restore_snapshot():\r\n    client = boto3.client('redshift', region_name='us-east-1')\r\n    # Make a cluster for a snapshot to associate with\r\n    client.create_cluster(\r\n        ClusterIdentifier='whatever',\r\n        MasterUsername='whoever',\r\n        MasterUserPassword='wh473v3r',\r\n        NodeType='multi-node',\r\n        NumberOfNodes=2,\r\n    )\r\n    # And a snapshot to test with\r\n    client.create_cluster_snapshot(\r\n        SnapshotIdentifier='testsnapshot',\r\n        ClusterIdentifier='whatever',\r\n    )\r\n\r\n    restore_snapshot(client, 'testsnapshot')\r\n```\r\n\r\nThis test will promptly fail thanks to the tight settings for the `WaiterConfig`, but if left at its defaults the test would instead hang for thirty minutes, and then fail.\r\n\r\nMoto's Redshift backend will never generate the `RestoreStatus` object that botocore's `ClusterRestored` waiter searches for, so we can't mock out this kind of interaction yet."},"comment":{"url":"https://api.github.com/repos/spulec/moto/issues/comments/384124458","html_url":"https://github.com/spulec/moto/issues/1506#issuecomment-384124458","issue_url":"https://api.github.com/repos/spulec/moto/issues/1506","id":384124458,"user":{"login":"bpandola","id":11675295,"avatar_url":"https://avatars0.githubusercontent.com/u/11675295?v=4","gravatar_id":"","url":"https://api.github.com/users/bpandola","html_url":"https://github.com/bpandola","followers_url":"https://api.github.com/users/bpandola/followers","following_url":"https://api.github.com/users/bpandola/following{/other_user}","gists_url":"https://api.github.com/users/bpandola/gists{/gist_id}","starred_url":"https://api.github.com/users/bpandola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpandola/subscriptions","organizations_url":"https://api.github.com/users/bpandola/orgs","repos_url":"https://api.github.com/users/bpandola/repos","events_url":"https://api.github.com/users/bpandola/events{/privacy}","received_events_url":"https://api.github.com/users/bpandola/received_events","type":"User","site_admin":false},"created_at":"2018-04-25T00:43:59Z","updated_at":"2018-04-25T00:43:59Z","author_association":"CONTRIBUTOR","body":"@ahill-mlft I added support for your basic use-case in #1597.  Are there other Redshift waiters you'd like to see implemented?"}}
{"actor":{"display_login":"bpandola"}}