fix name typo (#330)

This commit is contained in:
Jim authored and GitHub committed 2020-09-04 17:11:51 -04:00
1 parent 26ac00e67b
commit 3d944a616f
4 files changed
+9 -11

No files matched your search

@@ -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)
}
+1 -3
View File
@@ -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)
+2 -2
View File
@@ -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)
}
+5 -5
View File
@@ -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