Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions internal/fakes/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 7 additions & 3 deletions internal/libdocker/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 0 additions & 1 deletion internal/libdocker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down
9 changes: 5 additions & 4 deletions internal/libhive/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion internal/libhive/dockerface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down