From 3d944a616ffd4c966b3a5f0721874b6faa0bf272 Mon Sep 17 00:00:00 2001 From: Jim Date: Fri, 4 Sep 2020 17:11:51 -0400 Subject: [PATCH] fix name typo (#330) --- .../controller/handlers/targets/target_service.go | 2 +- internal/target/immutable_fields_test.go | 4 +--- internal/target/repository.go | 4 ++-- internal/target/repository_test.go | 10 +++++----- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/internal/servers/controller/handlers/targets/target_service.go b/internal/servers/controller/handlers/targets/target_service.go index 1e29cb376..bb56a2a63 100644 --- a/internal/servers/controller/handlers/targets/target_service.go +++ b/internal/servers/controller/handlers/targets/target_service.go @@ -299,7 +299,7 @@ func (s Service) addInRepo(ctx context.Context, targetId string, hostSetId []str if err != nil { return nil, err } - out, m, err := repo.AddTargeHostSets(ctx, targetId, version, hostSetId) + out, m, err := repo.AddTargetHostSets(ctx, targetId, version, hostSetId) if err != nil { return nil, status.Errorf(codes.Internal, "Unable to add host sets to target: %v.", err) } diff --git a/internal/target/immutable_fields_test.go b/internal/target/immutable_fields_test.go index 8ec05c3f7..1a9eeff12 100644 --- a/internal/target/immutable_fields_test.go +++ b/internal/target/immutable_fields_test.go @@ -2,7 +2,6 @@ package target import ( "context" - "fmt" "testing" "github.com/hashicorp/boundary/internal/db" @@ -71,7 +70,6 @@ func TestTarget_ImmutableFields(t *testing.T) { require.NoError(err) tt.update.SetTableName("target") - fmt.Println(tt.update.TableName(), tt.update) rowsUpdated, err := rw.Update(context.Background(), tt.update, tt.fieldMask, nil) require.Error(err) assert.Equal(0, rowsUpdated) @@ -173,7 +171,7 @@ func TestTargetHostSet_ImmutableFields(t *testing.T) { updateTarget := TestTcpTarget(t, conn, proj.PublicId, testId(t)) updateHset := hsets[1] - _, gotHostSets, err := repo.AddTargeHostSets(context.Background(), projTarget.PublicId, 1, []string{hsets[0].PublicId}) + _, gotHostSets, err := repo.AddTargetHostSets(context.Background(), projTarget.PublicId, 1, []string{hsets[0].PublicId}) require.NoError(t, err) require.Equal(t, 1, len(gotHostSets)) new, err := NewTargetHostSet(projTarget.PublicId, gotHostSets[0].PublicId) diff --git a/internal/target/repository.go b/internal/target/repository.go index d264eacee..805d620fd 100644 --- a/internal/target/repository.go +++ b/internal/target/repository.go @@ -267,12 +267,12 @@ func (r *Repository) update(ctx context.Context, target Target, version uint32, return returnedTarget.(Target), hostSets, rowsUpdated, err } -// AddTargeHostSets provides the ability to add host sets (hostSetIds) to a +// AddTargetHostSets provides the ability to add host sets (hostSetIds) to a // target (targetId). The target's current db version must match the // targetVersion or an error will be returned. The target and a list of // current host set ids will be returned on success. Zero is not a valid value // for the WithVersion option and will return an error. -func (r *Repository) AddTargeHostSets(ctx context.Context, targetId string, targetVersion uint32, hostSetIds []string, opt ...Option) (Target, []*TargetSet, error) { +func (r *Repository) AddTargetHostSets(ctx context.Context, targetId string, targetVersion uint32, hostSetIds []string, opt ...Option) (Target, []*TargetSet, error) { if targetId == "" { return nil, nil, fmt.Errorf("add target host sets: missing target id: %w", db.ErrInvalidParameter) } diff --git a/internal/target/repository_test.go b/internal/target/repository_test.go index c938ee222..248a7de72 100644 --- a/internal/target/repository_test.go +++ b/internal/target/repository_test.go @@ -371,7 +371,7 @@ func TestRepository_AddTargetHostSets(t *testing.T) { hostSetIds = createHostSetsFn([]string{staticOrg.PublicId}, []string{staticProj.PublicId}) } - gotTarget, gotHostSets, err := repo.AddTargeHostSets(context.Background(), projTarget.PublicId, tt.args.targetVersion, hostSetIds, tt.args.opt...) + gotTarget, gotHostSets, err := repo.AddTargetHostSets(context.Background(), projTarget.PublicId, tt.args.targetVersion, hostSetIds, tt.args.opt...) if tt.wantErr { require.Error(err) if tt.wantErrIs != nil { @@ -539,7 +539,7 @@ func TestRepository_DeleteTargetHosts(t *testing.T) { hsIds = append(hsIds, hsets[0].PublicId) } } - _, addedHostSets, err := repo.AddTargeHostSets(context.Background(), tt.args.target.GetPublicId(), 1, hsIds, tt.args.opt...) + _, addedHostSets, err := repo.AddTargetHostSets(context.Background(), tt.args.target.GetPublicId(), 1, hsIds, tt.args.opt...) require.NoError(err) assert.Equal(tt.args.createCnt, len(addedHostSets)) @@ -572,7 +572,7 @@ func TestRepository_DeleteTargetHosts(t *testing.T) { // test to make sure that the oplog entry for a target update // doesn't exist because the db.TestVerifyOplog doesn't really // support that level of testing and the previous call to - // repo.AddTargeHostSets() would create an oplog entry for the + // repo.AddTargetHostSets() would create an oplog entry for the // update to the target. Once TestVerifyOplog supports the // appropriate granularity, we should add an appropriate assert. @@ -588,7 +588,7 @@ func TestRepository_DeleteTargetHosts(t *testing.T) { // test to make sure that the oplog entry for a target update // doesn't exist because the db.TestVerifyOplog doesn't really // support that level of testing and the previous call to - // repo.AddTargeHostSets() would create an oplog entry for the + // repo.AddTargetHostSets() would create an oplog entry for the // update to the target. Once TestVerifyOplog supports the // appropriate granularity,, we should add an appropriate assert. @@ -630,7 +630,7 @@ func TestRepository_SetTargetHostSets(t *testing.T) { setupFn := func(target Target) []*TargetSet { hs := createHostSetsFn() - _, created, err := repo.AddTargeHostSets(context.Background(), target.GetPublicId(), 1, hs) + _, created, err := repo.AddTargetHostSets(context.Background(), target.GetPublicId(), 1, hs) require.NoError(t, err) require.Equal(t, 10, len(created)) return created