1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16+ import builtins
1617import json
1718import tempfile
1819import time
2324import uuid
2425
2526
26- import builtins
27+ # Propagation delays for Device Registration API resource creation.
28+ DEVICE_MODEL_PROPAGATION_DELAY_S = 30
29+ DEVICE_INSTANCE_PROPAGATION_DELAY_S = 60
30+
2731PROJECT_ID = os .environ .get ('PROJECT_ID' , 'dummy-project-id' )
2832
2933
@@ -38,9 +42,9 @@ def device_model():
3842 '--trait' , 'action.devices.traits.OnOff' ,
3943 '--manufacturer' , 'assistant-sdk-test' ,
4044 '--product-name' , 'assistant-sdk-test' ])
41- # Wait 10s for model registration to be consistent
45+ # Wait for model registration to be consistent
4246 # on the Device Registration API.
43- time .sleep (10 )
47+ time .sleep (DEVICE_MODEL_PROPAGATION_DELAY_S )
4448 yield device_model_id
4549 subprocess .check_call (['python' , '-m' ,
4650 'googlesamples.assistant.grpc.devicetool' ,
@@ -57,9 +61,9 @@ def device_instance(device_model):
5761 'register-device' , '--model' , device_model ,
5862 '--client-type' , 'SERVICE' ,
5963 '--device' , device_instance_id ])
60- # Wait 30s for device registration to be consistent
64+ # Wait for device registration to be consistent
6165 # on the Device Registration API.
62- time .sleep (30 )
66+ time .sleep (DEVICE_INSTANCE_PROPAGATION_DELAY_S )
6367 yield device_instance_id
6468 subprocess .check_call (['python' , '-m' ,
6569 'googlesamples.assistant.grpc.devicetool' ,
0 commit comments