Skip to content

Commit

Permalink
containerupdate: add a span where we were missing one (#3621)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maia McCormick committed Jul 28, 2020
1 parent 143c02c commit a14016f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions internal/cli/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions internal/containerupdate/docker_container_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"

"github.com/tilt-dev/tilt/internal/build"
Expand All @@ -16,18 +17,21 @@ import (
"github.com/tilt-dev/tilt/pkg/model"
)

type DockerContainerUpdater struct {
type DockerUpdater struct {
dCli docker.Client
}

var _ ContainerUpdater = &DockerContainerUpdater{}
var _ ContainerUpdater = &DockerUpdater{}

func NewDockerContainerUpdater(dCli docker.Client) *DockerContainerUpdater {
return &DockerContainerUpdater{dCli: dCli}
func NewDockerUpdater(dCli docker.Client) *DockerUpdater {
return &DockerUpdater{dCli: dCli}
}

func (cu *DockerContainerUpdater) UpdateContainer(ctx context.Context, cInfo store.ContainerInfo,
func (cu *DockerUpdater) UpdateContainer(ctx context.Context, cInfo store.ContainerInfo,
archiveToCopy io.Reader, filesToDelete []string, cmds []model.Cmd, hotReload bool) error {
span, ctx := opentracing.StartSpanFromContext(ctx, "DockerUpdater-UpdateContainer")
defer span.Finish()

l := logger.Get(ctx)

err := cu.rmPathsFromContainer(ctx, cInfo.ContainerID, filesToDelete)
Expand Down Expand Up @@ -64,7 +68,7 @@ func (cu *DockerContainerUpdater) UpdateContainer(ctx context.Context, cInfo sto
return nil
}

func (cu *DockerContainerUpdater) rmPathsFromContainer(ctx context.Context, cID container.ID, paths []string) error {
func (cu *DockerUpdater) rmPathsFromContainer(ctx context.Context, cID container.ID, paths []string) error {
if len(paths) == 0 {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/containerupdate/docker_container_updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ type dockerContainerUpdaterFixture struct {
t testing.TB
ctx context.Context
dCli *docker.FakeClient
dcu *DockerContainerUpdater
dcu *DockerUpdater
}

func newDCUFixture(t testing.TB) *dockerContainerUpdaterFixture {
fakeCli := docker.NewFakeClient()
cu := &DockerContainerUpdater{dCli: fakeCli}
cu := &DockerUpdater{dCli: fakeCli}
ctx, _, _ := testutils.CtxAndAnalyticsForTest()

return &dockerContainerUpdaterFixture{
Expand Down
4 changes: 2 additions & 2 deletions internal/engine/live_update_build_and_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
var _ BuildAndDeployer = &LiveUpdateBuildAndDeployer{}

type LiveUpdateBuildAndDeployer struct {
dcu *containerupdate.DockerContainerUpdater
dcu *containerupdate.DockerUpdater
scu *containerupdate.SyncletUpdater
ecu *containerupdate.ExecUpdater
updMode buildcontrol.UpdateMode
Expand All @@ -38,7 +38,7 @@ type LiveUpdateBuildAndDeployer struct {
clock build.Clock
}

func NewLiveUpdateBuildAndDeployer(dcu *containerupdate.DockerContainerUpdater,
func NewLiveUpdateBuildAndDeployer(dcu *containerupdate.DockerUpdater,
scu *containerupdate.SyncletUpdater, ecu *containerupdate.ExecUpdater,
updMode buildcontrol.UpdateMode, env k8s.Env, runtime container.Runtime, c build.Clock) *LiveUpdateBuildAndDeployer {
return &LiveUpdateBuildAndDeployer{
Expand Down
2 changes: 1 addition & 1 deletion internal/engine/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var DeployerBaseWireSet = wire.NewSet(
// BuildOrder
NewLocalTargetBuildAndDeployer,
NewImageBuildAndDeployer,
containerupdate.NewDockerContainerUpdater,
containerupdate.NewDockerUpdater,
containerupdate.NewSyncletUpdater,
containerupdate.NewExecUpdater,
NewLiveUpdateBuildAndDeployer,
Expand Down
4 changes: 2 additions & 2 deletions internal/engine/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a14016f

Please sign in to comment.