code: def test_metric_best(relay_server, user, publish_util, mock_run):
      run = mock_run(use_magic_mock=True)
      with relay_server() as relay:
          history = _gen_history()
          m1 = pb.MetricRecord(name="mystep")
          m2 = pb.MetricRecord(name="v1", step_metric="mystep")
          m2.summary.best = True
          m2.goal = m2.GOAL_MAXIMIZE
          m3 = pb.MetricRecord(name="v2", step_metric="mystep")
          m3.summary.best = True
          m3.goal = m3.GOAL_MINIMIZE
          metrics = _make_metrics([m1, m2, m3])
          publish_util(run=run, history=history, metrics=metrics)
  
      summary = relay.context.get_run_summary(run.id)
      history = relay.context.get_run_history(
          run.id, include_private=True
      )
      assert summary["v1"] == {"best": 3}
      assert summary["v2"] == {"best": 2}
      assert history["v1"][2] == 2
      assert history["v2"][2] == 3
      assert history["v3"][2] == "pizza"
      assert history["mystep"][2] == 3
      assert history["_step"][2] == 2
  
imports: from wandb.proto import wandb_internal_pb2
label_desc: Use image node_id 20 for calling a global function with example usage: test_metric_best(relay_server, user, publish_util, mock_run) without return types