Skip to content

Commit 0307c16

Browse files
authored
Merge pull request docker#10116 from glours/add-buildx-plugin-e2e
cleanup framework.go from uncessary debug logs
2 parents 6c537cc + adf8e75 commit 0307c16

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

pkg/e2e/framework.go

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ func initializePlugins(t testing.TB, configDir string) {
133133

134134
require.NoError(t, os.MkdirAll(filepath.Join(configDir, "cli-plugins"), 0o755),
135135
"Failed to create cli-plugins directory")
136-
composePlugin, err := findExecutable(t, DockerComposeExecutableName)
137-
if err != nil {
138-
t.Errorf("WARNING: docker-compose cli-plugin not found %s", err.Error())
136+
composePlugin, err := findExecutable(DockerComposeExecutableName)
137+
if os.IsNotExist(err) {
138+
t.Logf("WARNING: docker-compose cli-plugin not found")
139139
}
140140

141141
if err == nil {
@@ -160,24 +160,16 @@ func dirContents(dir string) []string {
160160
return res
161161
}
162162

163-
func findExecutable(t testing.TB, executableName string) (string, error) {
164-
filename, err := os.Getwd()
165-
if err != nil {
166-
return "", err
167-
}
168-
t.Logf("Current dir %s", filename)
169-
root := filepath.Join(filepath.Dir(filename), "..")
170-
t.Logf("Root dir %s", root)
171-
163+
func findExecutable(executableName string) (string, error) {
164+
_, filename, _, _ := runtime.Caller(0)
165+
root := filepath.Join(filepath.Dir(filename), "..", "..")
172166
buildPath := filepath.Join(root, "bin", "build")
173167

174168
bin, err := filepath.Abs(filepath.Join(buildPath, executableName))
175169
if err != nil {
176-
t.Errorf("Error finding compose binary %s", err.Error())
177170
return "", err
178171
}
179172

180-
t.Logf("binary path %s", bin)
181173
if _, err := os.Stat(bin); err == nil {
182174
return bin, nil
183175
}
@@ -204,28 +196,19 @@ func findPluginExecutable(pluginExecutableName string) (string, error) {
204196
// CopyFile copies a file from a sourceFile to a destinationFile setting permissions to 0755
205197
func CopyFile(t testing.TB, sourceFile string, destinationFile string) {
206198
t.Helper()
207-
t.Logf("copy %s to %s", sourceFile, destinationFile)
208199

209200
src, err := os.Open(sourceFile)
210201
require.NoError(t, err, "Failed to open source file: %s")
211202
//nolint:errcheck
212203
defer src.Close()
213-
t.Logf("Source file opened %s ", src.Name())
214204

215205
dst, err := os.OpenFile(destinationFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o755)
216206
require.NoError(t, err, "Failed to open destination file: %s", destinationFile)
217207
//nolint:errcheck
218208
defer dst.Close()
219-
t.Logf("Destination file opened %s ", dst.Name())
220209

221210
_, err = io.Copy(dst, src)
222211
require.NoError(t, err, "Failed to copy file: %s", sourceFile)
223-
t.Logf("File copied? %s ", err)
224-
fileStat, err := dst.Stat()
225-
if err != nil {
226-
t.Logf("Can't get file stat %s ", err)
227-
}
228-
t.Logf("File stat: %+v", fileStat)
229212
}
230213

231214
// BaseEnvironment provides the minimal environment variables used across all
@@ -346,7 +329,7 @@ func ComposeStandalonePath(t testing.TB) string {
346329
if !composeStandaloneMode {
347330
require.Fail(t, "Not running in standalone mode")
348331
}
349-
composeBinary, err := findExecutable(t, DockerComposeExecutableName)
332+
composeBinary, err := findExecutable(DockerComposeExecutableName)
350333
require.NoError(t, err, "Could not find standalone Compose binary (%q)",
351334
DockerComposeExecutableName)
352335
return composeBinary

0 commit comments

Comments
 (0)