MCPcopy Create free account
hub / github.com/clouditor/clouditor / AutoChdir

Function AutoChdir

internal/testutil/clitest/cli.go:132–148  ·  view source on GitHub ↗

AutoChdir automatically guesses if we need to change the current working directory so that we can find the policies folder

()

Source from the content-addressed store, hash-verified

130// AutoChdir automatically guesses if we need to change the current working directory
131// so that we can find the policies folder
132func AutoChdir() {
133 var (
134 err error
135 )
136
137 // Check, if we can find the policies folder
138 _, err = os.Stat("policies")
139 if errors.Is(err, os.ErrNotExist) {
140 // Try again one level deeper
141 err = os.Chdir("..")
142 if err != nil {
143 panic(err)
144 }
145
146 AutoChdir()
147 }
148}

Callers 12

TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92

Calls

no outgoing calls

Tested by 12

TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74