getTmpDirectory creates a temporary directory for shared integration test files, either in the working directory or a directory referenced by the E2E_TEMP_DIR environment variable.
()
| 684 | // test files, either in the working directory or a directory referenced by |
| 685 | // the E2E_TEMP_DIR environment variable. |
| 686 | func getTmpDirectory() (string, error) { |
| 687 | var ( |
| 688 | dir string |
| 689 | err error |
| 690 | ) |
| 691 | // If a temp dir is referenced, return that. |
| 692 | if os.Getenv("E2E_TEMP_DIR") != "" { |
| 693 | dir = os.Getenv("E2E_TEMP_DIR") |
| 694 | } else { |
| 695 | dir, err = os.Getwd() |
| 696 | if err != nil { |
| 697 | return "", err |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | tmpDir, err := os.MkdirTemp(dir, "e2e_") |
| 702 | if err != nil { |
| 703 | return "", err |
| 704 | } |
| 705 | absDir, err := filepath.Abs(tmpDir) |
| 706 | if err != nil { |
| 707 | _ = os.RemoveAll(tmpDir) |
| 708 | return "", err |
| 709 | } |
| 710 | |
| 711 | return absDir, nil |
| 712 | } |
| 713 | |
| 714 | func (e *DockerEnvironment) Close() { |
| 715 | for _, c := range e.closers { |
no outgoing calls
no test coverage detected
searching dependent graphs…