hashicorp / hashicorp/consul

/tmp/consul-test folder is not deleted when test finishes

Open
#10,116 1 comment 0 reactions 0 assignees View on GitHub
theme/windows
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Overview of the Issue

When running a Consul CLI, it starts TestServer(s) to run test(s).
At https://github.com/hashicorp/consul/blob/master/sdk/testutil/io.go#L26, /tmp/consul-test folder is created as the base directory for all temporary directories and files created with TempDir and TempFile.
However /tmp/consul-test folder won't be deleted when the test finishes.

Can we delete this folder when test is done? Or can we have a flag in Consul CLI to disable test?

#### Reproduction Steps

Steps to reproduce this issue, eg:

1. Download and install Consul binary in Windows.
2. In cmd.exe, run `consul`
3. Check c:\tmp, there is a consul-test folder.
Screen Shot 2021-04-25 at 2 48 39 PM

### Consul info for both Client and Server

Client info

```
output from client 'consul info' command here
```

Server info

```
output from server 'consul info' command here
```

### Operating system and Environment details

Windows 10 & Windows 2019, consul v1.7.3 & v1.9.5

### Log Fragments

No log

Contributor guide

Open the contributing guide

Research direction

Start with sdk/testutil/io.go, especially the code that creates /tmp/consul-test and the TempDir or TempFile cleanup paths. Reproduce the behavior on Windows with the Consul CLI, then run the affected testutil tests. Done means the base temporary folder is removed when test execution finishes, including the reported Windows case.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.