code: def test_volumes_in_flow(
      tmpdir,
      source,
      destination,
      workspace,
      filewriter_exec_docker_image_built,
  ):
      if source:  # test manually set volume and workspace
          source = os.path.join(tmpdir, source)
          volumes = [str(source) + ":" + destination]
      else:  # test auto volume and workspace
          source = __cache_path__
  
      f = Flow().add(
          uses="docker://filewriter-exec",
          volumes=volumes,
          workspace=workspace,
      )
      with f:
          f.post(inputs=[Document()], on="/foo")
  
      assert os.path.exists(source)
  
      found_output_file = (
          False  # workspace has random element, so we search for it
      )
      for cur_path, dirs, files in os.walk(source):
          if "out.txt" in files:
              with open(
                  os.path.join(cur_path, "out.txt"),
                  "r",
                  encoding="utf-8",
              ) as f:
                  if f.read() == "Filewriter was here":
                      found_output_file = True
      assert found_output_file
  
file_path: jina/tests/integration/docker_volumes/test_volumes_in_flow.py
imports: import os
  import time
  import pytest
  from docarray import Document
  from jina import Flow
  from jina.constants import __cache_path__
label_desc: Use image node_id 2 for calling a global function with example usage: test_volumes_in_flow(tmpdir, source, destination, workspace, filewriter_exec_docker_image_built) without return types