Manifests reachable by NTT_CACHE overwrite "." root folders
5nord opened this issue · comments
Describe the bug
ntt can't load test-suite from directory .
, when a manifest file is already reachable by NTT_CACHE environment variable.
To Reproduce
# Initial setup:
# The temporary directory contains no package.yml. Therefore ntt is expected to use the directories base name as test suite name:
$ cd $(mktemp -d)
$ ntt show . -- name
tmp_ngu9w0zasp
# Bug:
# When there's a package.yml reachable by NTT_CACHE, ntt will ignore the base-name directory
$ mkdir some_dir
$ echo "name: bad" > some_dir/package.yml
$ NTT_CACHE=some_dir ntt show . -- name
bad
# Weird:
# NTT_CACHE is ignored and the expected test suite name is shown again, if there's a package.yml in current directory.
$ touch package.yml
NTT_CACHE=some_dir ntt show . -- name
tmp_ngu9w0zasp
Expected behavior
When we ask ntt to show configuration of "." we expect to use this and only this path.
Possible fixes
We should not use NTT_CACHE mechanism, when a path starts with ".". The filepath.Join
function however removes any dots:
$ cat main.go
package main
import (
"fmt"
"path/filepath"
)
func main() {
fmt.Println(filepath.Join("./foo/", "package.yml"))
}
$ go run
foo/package.yml
One possible fix would be not to use join
and let ntt clean the path later.