resolve linter issues

This commit is contained in:
David Christofas
2021-02-24 16:06:24 +01:00
parent b8ac8f1ddd
commit 20dbf299d0
5 changed files with 39 additions and 17 deletions
+13 -6
View File
@@ -12,7 +12,9 @@ import (
)
func TestMain(m *testing.M) {
loadStore()
if err := loadStore(); err != nil {
os.Exit(1)
}
os.Exit(m.Run())
}
@@ -20,13 +22,17 @@ var (
store = NewMapStorage()
)
func loadStore() {
func loadStore() error {
for i := 0; i < 20; i++ {
store.Store(process.ProcEntry{
Pid: rand.Int(),
if err := store.Store(process.ProcEntry{
Pid: rand.Int(), //nolint:gosec
Extension: fmt.Sprintf("extension-%s", strconv.Itoa(i)),
})
}); err != nil {
return err
}
}
return nil
}
func TestLoadAll(t *testing.T) {
@@ -35,9 +41,10 @@ func TestLoadAll(t *testing.T) {
}
func TestDelete(t *testing.T) {
store.Delete(process.ProcEntry{
err := store.Delete(process.ProcEntry{
Extension: "extension-1",
})
assert.Nil(t, err)
all := store.LoadAll()
assert.Zero(t, all["extension-1"])
}