Skip to content

Commit

Permalink
fix(pull): Pull uses network resolver. Fixes integration test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustmop committed Mar 30, 2021
1 parent 7d92e0c commit d049958
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (o *PullOptions) Run(args []string) error {
Remote: o.Remote,
}

res, err := o.inst.Dataset().Pull(ctx, p)
res, err := o.inst.WithSource("network").Dataset().Pull(ctx, p)
if err != nil {
return err
}
Expand Down
7 changes: 5 additions & 2 deletions lib/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -1492,18 +1492,21 @@ func (datasetImpl) Remove(scope scope, p *RemoveParams) (*RemoveResponse, error)
// a network connection
func (datasetImpl) Pull(scope scope, p *PullParams) (*dataset.Dataset, error) {
res := &dataset.Dataset{}
// TODO(dustmop): source has moved to the scope, and passing it to ParseAndResolveRef
// does nothing. Remove it from here and from the third parameter of that func
source := p.Remote
if source == "" {
source = "network"
}

ref, source, err := scope.ParseAndResolveRef(scope.Context(), p.Ref, source)
ref, location, err := scope.ParseAndResolveRef(scope.Context(), p.Ref, source)
if err != nil {
log.Debugf("resolving reference: %s", err)
return nil, err
}
log.Infof("pulling dataset from location: %s", location)

ds, err := scope.RemoteClient().PullDataset(scope.Context(), &ref, source)
ds, err := scope.RemoteClient().PullDataset(scope.Context(), &ref, location)
if err != nil {
log.Debugf("pulling dataset: %s", err)
return nil, err
Expand Down
6 changes: 2 additions & 4 deletions lib/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
)

func TestTwoActorRegistryIntegration(t *testing.T) {
t.Skip("TODO(dustmop): meaning of source changed, this needs to be fixed")

tr := NewNetworkIntegrationTestRunner(t, "integration_two_actor_registry")
defer tr.Cleanup()

Expand Down Expand Up @@ -70,7 +68,7 @@ func TestTwoActorRegistryIntegration(t *testing.T) {
PushToRegistry(tr.Ctx, t, nasim, ref.Alias())

// 7. hinshun logsyncs with the registry for world bank dataset, sees multiple versions
_, err = hinshun.Dataset().Pull(tr.Ctx, &PullParams{LogsOnly: true, Ref: ref.String()})
_, err = hinshun.WithSource("network").Dataset().Pull(tr.Ctx, &PullParams{LogsOnly: true, Ref: ref.String()})
if err != nil {
t.Errorf("cloning logs: %s", err)
}
Expand Down Expand Up @@ -437,7 +435,7 @@ func SearchFor(ctx context.Context, t *testing.T, inst *Instance, term string) [

func Pull(ctx context.Context, t *testing.T, inst *Instance, refstr string) *dataset.Dataset {
t.Helper()
res, err := inst.Dataset().Pull(ctx, &PullParams{Ref: refstr})
res, err := inst.WithSource("network").Dataset().Pull(ctx, &PullParams{Ref: refstr})
if err != nil {
t.Fatalf("cloning dataset %s: %s", refstr, err)
}
Expand Down

0 comments on commit d049958

Please sign in to comment.