add option db.WithSkipVetForWrite(true) so the db tests don't get intercepted by app validation (#332)

This commit is contained in:
Jim authored and GitHub committed 2020-09-07 13:20:49 -04:00
1 parent 1c2c078e0a
commit 96e4b1cdba
4 files changed
+15 -15

No files matched your search

+3 -3
View File
@@ -70,7 +70,7 @@ func TestTarget_ImmutableFields(t *testing.T) {
require.NoError(err)
tt.update.SetTableName("target")
rowsUpdated, err := rw.Update(context.Background(), tt.update, tt.fieldMask, nil)
rowsUpdated, err := rw.Update(context.Background(), tt.update, tt.fieldMask, nil, db.WithSkipVetForWrite(true))
require.Error(err)
assert.Equal(0, rowsUpdated)
@@ -137,7 +137,7 @@ func TestTcpTarget_ImmutableFields(t *testing.T) {
err := rw.LookupById(context.Background(), orig)
require.NoError(err)
rowsUpdated, err := rw.Update(context.Background(), tt.update, tt.fieldMask, nil)
rowsUpdated, err := rw.Update(context.Background(), tt.update, tt.fieldMask, nil, db.WithSkipVetForWrite(true))
require.Error(err)
assert.Equal(0, rowsUpdated)
@@ -218,7 +218,7 @@ func TestTargetHostSet_ImmutableFields(t *testing.T) {
err := rw.LookupWhere(context.Background(), orig, "target_id = ? and host_set_id = ?", new.TargetId, new.HostSetId)
require.NoError(err)
rowsUpdated, err := rw.Update(context.Background(), tt.update, tt.fieldMask, nil)
rowsUpdated, err := rw.Update(context.Background(), tt.update, tt.fieldMask, nil, db.WithSkipVetForWrite(true))
require.Error(err)
assert.Equal(0, rowsUpdated)