Skip to content

Commit 5dcadc0

Browse files
committed
debut output for CI
Signed-off-by: Guillaume Lours <[email protected]>
1 parent c72f161 commit 5dcadc0

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

pkg/e2e/framework.go

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,19 @@ 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(DockerComposeExecutableName)
136+
composePlugin, err := findExecutable(t, DockerComposeExecutableName)
137137
if err != nil {
138138
t.Errorf("WARNING: docker-compose cli-plugin not found %s", err.Error())
139139
}
140-
buildxPlugin, err := findPluginExecutable(DockerBuildxExecutableName)
141-
if os.IsNotExist(err) {
142-
t.Logf("WARNING: docker-buildx cli-plugin not found")
143-
}
140+
144141
if err == nil {
145142
CopyFile(t, composePlugin, filepath.Join(configDir, "cli-plugins", DockerComposeExecutableName))
146-
CopyFile(t, buildxPlugin, filepath.Join(configDir, "cli-plugins", DockerBuildxExecutableName))
143+
buildxPlugin, err := findPluginExecutable(DockerBuildxExecutableName)
144+
if err != nil {
145+
t.Logf("WARNING: docker-buildx cli-plugin not found, using default buildx installation.")
146+
} else {
147+
CopyFile(t, buildxPlugin, filepath.Join(configDir, "cli-plugins", DockerBuildxExecutableName))
148+
}
147149
// We don't need a functional scan plugin, but a valid plugin binary
148150
CopyFile(t, composePlugin, filepath.Join(configDir, "cli-plugins", DockerScanExecutableName))
149151
}
@@ -158,19 +160,24 @@ func dirContents(dir string) []string {
158160
return res
159161
}
160162

161-
func findExecutable(executableName string) (string, error) {
163+
func findExecutable(t testing.TB, executableName string) (string, error) {
162164
filename, err := os.Getwd()
163165
if err != nil {
164166
return "", err
165167
}
168+
t.Logf("Current dir %s", filename)
166169
root := filepath.Join(filepath.Dir(filename), "..")
170+
t.Logf("Root dir %s", root)
171+
167172
buildPath := filepath.Join(root, "bin", "build")
168173

169174
bin, err := filepath.Abs(filepath.Join(buildPath, executableName))
170175
if err != nil {
176+
t.Errorf("Error finding compose binary %s", err.Error())
171177
return "", err
172178
}
173179

180+
t.Logf("binary path %s", bin)
174181
if _, err := os.Stat(bin); err == nil {
175182
return bin, nil
176183
}
@@ -197,19 +204,28 @@ func findPluginExecutable(pluginExecutableName string) (string, error) {
197204
// CopyFile copies a file from a sourceFile to a destinationFile setting permissions to 0755
198205
func CopyFile(t testing.TB, sourceFile string, destinationFile string) {
199206
t.Helper()
207+
t.Logf("copy %s to %s", sourceFile, destinationFile)
200208

201209
src, err := os.Open(sourceFile)
202210
require.NoError(t, err, "Failed to open source file: %s")
203211
//nolint:errcheck
204212
defer src.Close()
213+
t.Logf("Source file opened %s ", src.Name())
205214

206215
dst, err := os.OpenFile(destinationFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o755)
207216
require.NoError(t, err, "Failed to open destination file: %s", destinationFile)
208217
//nolint:errcheck
209218
defer dst.Close()
219+
t.Logf("Destination file opened %s ", dst.Name())
210220

211221
_, err = io.Copy(dst, src)
212222
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)
213229
}
214230

215231
// BaseEnvironment provides the minimal environment variables used across all
@@ -330,7 +346,7 @@ func ComposeStandalonePath(t testing.TB) string {
330346
if !composeStandaloneMode {
331347
require.Fail(t, "Not running in standalone mode")
332348
}
333-
composeBinary, err := findExecutable(DockerComposeExecutableName)
349+
composeBinary, err := findExecutable(t, DockerComposeExecutableName)
334350
require.NoError(t, err, "Could not find standalone Compose binary (%q)",
335351
DockerComposeExecutableName)
336352
return composeBinary

0 commit comments

Comments
 (0)