Skip to content

Commit 919c9b3

Browse files
werbersoneabili0
authored andcommitted
remove key file name validation
1 parent a0cf909 commit 919c9b3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

manager/manager_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const basePath = "./data"
1414

1515
func TestMain(m *testing.M) {
1616
exitCode := m.Run()
17-
os.Remove(basePath)
17+
_ = os.Remove(basePath)
1818
os.Exit(exitCode)
1919
}
2020

@@ -56,7 +56,7 @@ func TestAddDNSRecordAndGetAndList(t *testing.T) {
5656
}
5757

5858
if len(records) != 1 {
59-
t.Errorf("Expecting the list of records to have exactly one entry. Got %v", len(records))
59+
t.Fatalf("Expecting the list of records to have exactly one entry. Got %v", len(records))
6060
}
6161

6262
if records[0].Name != rs[0].Name || records[0].Value != rs[0].Value || records[0].Type != rs[0].Type {
@@ -190,15 +190,15 @@ type MockDNSUpdater struct {
190190
RemovalCount uint64
191191
}
192192

193-
func (mnsu *MockDNSUpdater) AddRR(record hookTypes.DNSRecord, ttl time.Duration) error {
193+
func (mnsu *MockDNSUpdater) AddRR(_ hookTypes.DNSRecord, _ time.Duration) error {
194194
return mnsu.Error
195195
}
196196

197-
func (mnsu *MockDNSUpdater) RemoveRR(name, recordType string) error {
197+
func (mnsu *MockDNSUpdater) RemoveRR(_, _ string) error {
198198
atomic.AddUint64(&mnsu.RemovalCount, 1)
199199
return mnsu.Error
200200
}
201201

202-
func (mnsu *MockDNSUpdater) UpdateRR(record hookTypes.DNSRecord, ttl time.Duration) error {
202+
func (mnsu *MockDNSUpdater) UpdateRR(_ hookTypes.DNSRecord, _ time.Duration) error {
203203
return mnsu.Error
204204
}

nsupdate/misc_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestNSUpdate_buildDeleteCommand(t *testing.T) {
4747
Builder: tt.fields.Builder,
4848
}
4949
if got := nsu.buildDeleteCommand(tt.args.recordName, tt.args.recordType); got != tt.want {
50-
t.Errorf("NSUpdate.buildDeleteCommand() = %v, want %v", got, tt.want)
50+
t.Errorf("%s: NSUpdate.buildDeleteCommand() = %v, want %v", tt.name, got, tt.want)
5151
}
5252
})
5353
}
@@ -94,7 +94,7 @@ func TestNSUpdate_buildAddCommand(t *testing.T) {
9494
Builder: tt.fields.Builder,
9595
}
9696
if got := nsu.buildAddCommand(tt.args.recordName, tt.args.recordType, tt.args.value, tt.args.ttl); got != tt.want {
97-
t.Errorf("NSUpdate.buildAddCommand() = %v, want %v", got, tt.want)
97+
t.Errorf("%s: NSUpdate.buildAddCommand() = %v, want %v", tt.name, got, tt.want)
9898
}
9999
})
100100
}
@@ -149,12 +149,12 @@ func TestCheck(t *testing.T) {
149149
t.Errorf("It was expected success=false but returned true")
150150
}
151151
if len(errs) != len(test.expected.errs) {
152-
t.Errorf("The error array length must be %d but got %d", len(test.expected.errs), len(errs))
152+
t.Errorf("%s: The error array length must be %d but got %d", test.name, len(test.expected.errs), len(errs))
153153
t.FailNow()
154154
}
155155
for i, err := range test.expected.errs {
156156
if errs[i] != err {
157-
t.Errorf("Expected message was %s but got %s", err, errs[i])
157+
t.Errorf("%s: Expected message was %s but got %s", test.name, err, errs[i])
158158
}
159159
}
160160
})
@@ -271,7 +271,7 @@ func TestNSUpdate_getKeyFilePath(t *testing.T) {
271271
Builder: *tt.fields.Builder,
272272
}
273273
if got := nsu.getKeyFilePath(); got != tt.want {
274-
t.Errorf("NSUpdate.getKeyFilePath() = %v, want %v", got, tt.want)
274+
t.Errorf("%s: NSUpdate.getKeyFilePath() = %v, want %v", tt.name, got, tt.want)
275275
}
276276
})
277277
}

0 commit comments

Comments
 (0)