code: def test_resilience(storage, monkeypatch):
      """Test if Oríon stops after enough broken trials."""
  
      monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))
  
      MAX_BROKEN = 3
      orion.core.config.worker.max_broken = 3
  
      orion.core.cli.main(
          [
              "hunt",
              "--config",
              "./orion_config_random.yaml",
              "./broken_box.py",
              "-x~uniform(-50, 50)",
          ]
      )
  
      exp = experiment_builder.build(name="demo_random_search")
      assert len(exp.fetch_trials_by_status("broken")) == MAX_BROKEN
  
imports: import os
  import shutil
  import subprocess
  import sys
  import tempfile
  from collections import defaultdict
  from contextlib import contextmanager
  import numpy
  import pytest
  import yaml
  import orion.core.cli
  import orion.core.io.experiment_builder
  from orion.core.cli.hunt import workon
  from orion.testing import OrionState
label_desc: Use image node_id 19 for calling a global function with example usage: test_resilience(storage, monkeypatch) without return types