diff --git a/internal/fakes/container.go b/internal/fakes/container.go index ccda8d1c66..5042a1bb9a 100644 --- a/internal/fakes/container.go +++ b/internal/fakes/container.go @@ -128,9 +128,6 @@ func (b *fakeBackend) StartContainer(ctx context.Context, containerID string, op ip := net.IP{192, 0, 2, byte(b.clientCounter)} info.IP = ip.String() } - if info.MAC == "" { - info.MAC = "00:80:41:ae:fd:7e" - } info.Wait = func() {} return &info, nil } diff --git a/internal/libdocker/builder.go b/internal/libdocker/builder.go index 135ce715c0..92707a09d4 100644 --- a/internal/libdocker/builder.go +++ b/internal/libdocker/builder.go @@ -156,9 +156,13 @@ func (b *Builder) archiveFS(ctx context.Context, out io.WriteCloser, fsys fs.FS) return err } - // TODO: errors - w.Flush() - w.Close() + // Handle tar writer errors properly + if err := w.Flush(); err != nil { + return err + } + if err := w.Close(); err != nil { + return err + } return nil } diff --git a/internal/libdocker/container.go b/internal/libdocker/container.go index cc976e8499..4e1b62e8a4 100644 --- a/internal/libdocker/container.go +++ b/internal/libdocker/container.go @@ -156,7 +156,6 @@ func (b *ContainerBackend) StartContainer(ctx context.Context, containerID strin return info, err } info.IP = container.NetworkSettings.IPAddress - info.MAC = container.NetworkSettings.MacAddress // Set up the port check if requested. hasStarted := make(chan struct{}) diff --git a/internal/libhive/api.go b/internal/libhive/api.go index 62fecbb00e..84d4a5822c 100644 --- a/internal/libhive/api.go +++ b/internal/libhive/api.go @@ -321,11 +321,12 @@ func (api *simAPI) startClient(w http.ResponseWriter, r *http.Request) { // Note that jsonPath gets written to the result JSON and always uses '/' as the separator. // The filePath is passed to the docker backend and uses the platform separator. func (api *simAPI) clientLogFilePaths(clientName, containerID string) (jsonPath string, file string) { - // TODO: might be nice to put timestamp into the filename as well. - safeDir := strings.Replace(clientName, string(filepath.Separator), "_", -1) - jsonPath = path.Join(safeDir, fmt.Sprintf("client-%s.log", containerID)) + ts := time.Now().UTC().Format("20060102T150405Z") // yyyymmddThhmmssZ + safeDir := strings.ReplaceAll(clientName, string(filepath.Separator), "_") + fname := fmt.Sprintf("client-%s-%s.log", ts, containerID) + jsonPath = path.Join(safeDir, fname) file = filepath.Join(api.env.LogDir, filepath.FromSlash(jsonPath)) - return jsonPath, file + return } func (api *simAPI) checkClient(req *simapi.NodeConfig) (*ClientDefinition, error) { diff --git a/internal/libhive/dockerface.go b/internal/libhive/dockerface.go index 6c0aecc23f..b63a66208f 100644 --- a/internal/libhive/dockerface.go +++ b/internal/libhive/dockerface.go @@ -69,7 +69,6 @@ type ContainerOptions struct { type ContainerInfo struct { ID string // docker container ID IP string // IP address - MAC string // MAC address. TODO: remove LogFile string // The wait function returns when the container is stopped.